﻿#include "CPdfReport.h"

#include <QDateTime>
#include <QRandomGenerator>
#include "CPublicData.h"
#include "CHeader.h"
#include "CTaskExecInfo.h"
#include "CDevDataBase.h"

#include <QElapsedTimer>
#include "cimagedownloader.h"


CPdfReport::CPdfReport(QObject *parent)
	: QObject(parent)
{

}

CPdfReport::~CPdfReport()
{

}

//获取两点托辊号之间的 连续红外检测数据、连续噪声检测数据
void CPdfReport::getBetwTwoRollerCotData(int nStartRoller, int nEndRoller, QMap<int, QVector<CPdfCotIrInfo>> &mapCotIr, QMap<int, QVector<CPdfCotVoiceInfo>> &mapCotVoice, QVector<CPdfCotIrInfo> &vecAllCotIr, QVector<CPdfCotVoiceInfo> &vecAllCotVoice)
{
	if (nStartRoller >  nEndRoller)//开始托辊号大于结束托辊号，则返回
	{
		return;
	}
	for (int i = 0; i < vecAllCotIr.size(); i++)
	{
		if (vecAllCotIr[i].m_nRollerCode >= nStartRoller && vecAllCotIr[i].m_nRollerCode < nEndRoller)
		{
			if (mapCotIr.contains(vecAllCotIr[i].m_nRollerCode))
			{
				// 获取对应的 QVector
				QVector<CPdfCotIrInfo> &vecData = mapCotIr[vecAllCotIr[i].m_nRollerCode];
				vecData.append(vecAllCotIr[i]);
			}
			else
			{
				QVector<CPdfCotIrInfo> vecData;
				vecData.append(vecAllCotIr[i]);
				mapCotIr.insert(vecAllCotIr[i].m_nRollerCode, vecData);
			}
		}
	}

	//噪声按要求先删掉
}

//获取连续检测红外Map数据
void CPdfReport::getCotMapIrData(QMap<int, QVector<CPdfCotIrInfo>> &mapCotIr, QVector<CPdfCotIrInfo> &vecAllCotIr)
{
	for (int i = 0; i < vecAllCotIr.size(); i++)
	{
		if (mapCotIr.contains(vecAllCotIr[i].m_nRollerCode))
		{
			// 获取对应的 QVector
			QVector<CPdfCotIrInfo> &vecData = mapCotIr[vecAllCotIr[i].m_nRollerCode];
			vecData.append(vecAllCotIr[i]);
		}
		else
		{
			QVector<CPdfCotIrInfo> vecData;
			vecData.append(vecAllCotIr[i]);
			mapCotIr.insert(vecAllCotIr[i].m_nRollerCode, vecData);
		}
	}
}

//获取连续检测声音Map数据
void CPdfReport::getCotMapVoiceData(QMap<int, QVector<CPdfCotVoiceInfo>> &mapCotVoice, QVector<CPdfCotVoiceInfo> &vecAllCotVoice)
{
	for (int i = 0; i < vecAllCotVoice.size(); i++)
	{
		if (mapCotVoice.contains(vecAllCotVoice[i].m_nRollerCode))
		{
			// 获取对应的 QVector
			QVector<CPdfCotVoiceInfo> &vecData = mapCotVoice[vecAllCotVoice[i].m_nRollerCode];
			vecData.append(vecAllCotVoice[i]);
		}
		else
		{
			QVector<CPdfCotVoiceInfo> vecData;
			vecData.append(vecAllCotVoice[i]);
			mapCotVoice.insert(vecAllCotVoice[i].m_nRollerCode, vecData);
		}
	}
}

//获取连续检测图像Map数据
void CPdfReport::getCotMapImageData(QMap<int, QVector<CPdfCotImageInfo>> &mapCotImage, QVector<CPdfCotImageInfo> &vecAllCotImage)
{
	for (int i = 0; i < vecAllCotImage.size(); i++)
	{
		if (mapCotImage.contains(vecAllCotImage[i].m_nRollerCode))
		{
			// 获取对应的 QVector
			QVector<CPdfCotImageInfo> &vecData = mapCotImage[vecAllCotImage[i].m_nRollerCode];
			vecData.append(vecAllCotImage[i]);
		}
		else
		{
			QVector<CPdfCotImageInfo> vecData;
			vecData.append(vecAllCotImage[i]);
			mapCotImage.insert(vecAllCotImage[i].m_nRollerCode, vecData);
		}
	}
}

//计算连续检测结果归属层级
void CPdfReport::calculateCotRetBelongTier(QMap<int, QVector<CPdfCotIrInfo>> &mapCotIr, QMap<int, QVector<CPdfCotVoiceInfo>> &mapCotVoice, QMap<int, QVector<CPdfCotImageInfo>> &mapCotImage)
{
	//一个Int托辊对应的QVector是两个数据,时间小的是去程 时间大的是归程
	//一个托辊号 对应QVector中的两条数据
	for (QMap<int, QVector<CPdfCotIrInfo>>::iterator i = mapCotIr.begin(); i != mapCotIr.end(); i++)
	{
		QVector<CPdfCotIrInfo> &vecData = i.value();

		if (vecData.size() >= 2)
		{
			qint64 timestamp1 = vecData[0].m_dtActionTime.toSecsSinceEpoch();
			qint64 timestamp2 = vecData[1].m_dtActionTime.toSecsSinceEpoch();
			if (timestamp1 < timestamp2)
			{
				vecData[0].nBelongTier = 0;//归属层级 0:去程 1:归程
				vecData[1].nBelongTier = 1;
			}
			else
			{
				vecData[0].nBelongTier = 1;//归属层级 0:去程 1:归程
				vecData[1].nBelongTier = 0;
			}
		}
	}

	for (QMap<int, QVector<CPdfCotVoiceInfo>>::iterator i = mapCotVoice.begin(); i != mapCotVoice.end(); i++)
	{
		QVector<CPdfCotVoiceInfo> &vecData = i.value();

		if (vecData.size() >= 2)
		{
			qint64 timestamp1 = vecData[0].m_dtActionTime.toSecsSinceEpoch();
			qint64 timestamp2 = vecData[1].m_dtActionTime.toSecsSinceEpoch();
			if (timestamp1 < timestamp2)
			{
				vecData[0].nBelongTier = 0;//归属层级 0:去程 1:归程
				vecData[1].nBelongTier = 1;
			}
			else
			{
				vecData[0].nBelongTier = 1;//归属层级 0:去程 1:归程
				vecData[1].nBelongTier = 0;
			}
		}
	}

	for (QMap<int, QVector<CPdfCotImageInfo>>::iterator i = mapCotImage.begin(); i != mapCotImage.end(); i++)
	{
		QVector<CPdfCotImageInfo> &vecData = i.value();

		if (vecData.size() >= 2)
		{
			qint64 timestamp1 = vecData[0].m_dtActionTime.toSecsSinceEpoch();
			qint64 timestamp2 = vecData[1].m_dtActionTime.toSecsSinceEpoch();
			if (timestamp1 < timestamp2)
			{
				vecData[0].nBelongTier = 0;//归属层级 0:去程 1:归程
				vecData[1].nBelongTier = 1;
			}
			else
			{
				vecData[0].nBelongTier = 1;//归属层级 0:去程 1:归程
				vecData[1].nBelongTier = 0;
			}
		}
	}
}

//绘制新的一个连续红外
void CPdfReport::drawNewPageCotIr(QMap<int, QVector<CPdfCotIrInfo>> &mapCotIrInfo, QPainter &painter, QPrinter &printer)
{
	QPen penNormal(Qt::black, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色
	QPen penNormalRed(Qt::red, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常红色
	QPen penJiaCu(Qt::black, 3, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色加粗

	QFont fontPage2Normal("Arial", 18, QFont::Normal);//普通
	QFont fontPage2Red("Arial", 18, QFont::Bold);//普通红色
	QFont fontPage2SmallNormal("Arial", 12, QFont::Normal);//普通
	QFont fontPage2JiaCu("Arial", 18, QFont::Bold);//加粗
	QFont fontPage2SmallJiaCu("Arial", 14, QFont::Bold);//加粗
	QFont fontPage2Bold("Arial", 24, QFont::Bold);//加粗

	QString strTableCaption = "";

	//先统计总数
	int nCount = 0;
	for (QMap<int, QVector<CPdfCotIrInfo>>::iterator i = mapCotIrInfo.begin(); i != mapCotIrInfo.end(); i++)
	{
		nCount += i.value().size();
	}


	//先计算A4纸是否满足 不然就要自定义高度
	if (nCount > 3)//异常信息列表大于3行,A4纸大小就不够了
	{
		//int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
		int nPageHeightVal = 297 + (nCount * 6 - 21 + 1) * 11;//这个大小测试的适配成功
		//QSizeF pageSizeTemp(210, 1000);
		QSizeF pageSizeTemp(210, nPageHeightVal);
		printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
	}
	else
	{
		printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	}


	painter.setPen(penNormal);
	int nRowCount = 3;  // 表格行数
	int nColumnCount = 4;  // 表格列数

	int nCellWidth = 140;  // 单元格宽度
	int nCellHeight = 30;  // 单元格高度

	int cellStartX = 8;//表格起点坐标X

	//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	printer.newPage(); // 添加新的一页

#if 0
	painter.setFont(fontPage2Bold);
	strTableCaption = A2T("连续红外检测详细描述");//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption); // 表格标题
#endif

	// 绘制第一行合并的单元格
	QRect merged_cell_rectVoice(cellStartX, 60 - 40, nCellWidth * 4, nCellHeight * 2);//高度占2行
	painter.drawRect(merged_cell_rectVoice);  // 绘制单元格边框
	painter.drawText(merged_cell_rectVoice, Qt::AlignCenter, A2T("连续托辊检测"));  // 绘制单元格内容

	// 绘制第二行标题栏
	int nRowTemporary = 2;//从2行开始
	nRowTemporary += 1;//因为第一行用了两行的高度，所有要+1
	for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
	{
		QRect cell_rect(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);
		painter.drawRect(cell_rect);  // 绘制单元格边框
		//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容


		if (nCol == 0)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));//米(托辊号)
		}
		else if (nCol == 1)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("测量值"));
		}
		else if (nCol == 2)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("状态"));
		}
		else if (nCol == 3)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("阈值"));
		}


	}
	nRowTemporary++;

	//遍历红外报警列表，往后继续绘制
	for (QMap<int, QVector<CPdfCotIrInfo>>::iterator i = mapCotIrInfo.begin(); i != mapCotIrInfo.end(); i++)
	{
		QVector<CPdfCotIrInfo> vecData = i.value();

		for (int nAlmIndex = 0; nAlmIndex < vecData.size(); nAlmIndex++)
		{
			//============红外测温
			//先绘制第一列合并上下两个单元格 位置
			QRect merged_cell_Temp1(cellStartX, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight * 6);//6倍的高度,因为要放图片 150
			painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			QString sLoca = A2T("托辊:%1(%2m)").arg(vecData[nAlmIndex].m_sRollerDesc).arg(QString::number(vecData[nAlmIndex].m_dLocation, 'f', 1));
			painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sLoca);

			//绘制右侧的测量值、状态、备注这3个信息单元格
			painter.setFont(fontPage2Normal);
			for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				if (nCol == 1)//测量值
				{
					if (0 == vecData[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}


					painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("最高") + QString::number(vecData[nAlmIndex].m_doMeasurementVal) + A2T("℃"));
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 2)//状态
				{
					if (0 == vecData[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}

					painter.drawText(cell_rectTemp, Qt::AlignCenter, vecData[nAlmIndex].m_strAlmDesc);
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 3)//备注
				{
					painter.drawText(cell_rectTemp, Qt::AlignCenter, vecData[nAlmIndex].m_sRemark);
				}
			}

			//绘制图片栏
			QPixmap pixmapPic(vecData[nAlmIndex].m_sPictureAddress);
			painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

			//绘制图片备注栏
			QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
			painter.drawRect(mergedCellTemp);  // 绘制单元格边框

			painter.setFont(fontPage2SmallNormal);
			painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecData[nAlmIndex].m_sPictureRemark);
			painter.setFont(fontPage2Normal);
			

			nRowTemporary += 6;
		}
	}
	
}

//绘制新的一个连续红外+连续声音在一起
void CPdfReport::drawNewPageCotAll(QMap<int, QVector<CPdfCotIrInfo>> &mapCotIrInfo, QMap<int, QVector<CPdfCotVoiceInfo>> &mapCotVoice, QMap<int, QVector<CPdfCotImageInfo>> &mapCotImage, QPainter &painter, QPrinter &printer)
{
	QPen penNormal(Qt::black, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色
	QPen penNormalRed(Qt::red, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常红色
	QPen penJiaCu(Qt::black, 3, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色加粗

	QFont fontPage2Normal("Arial", 18, QFont::Normal);//普通
	QFont fontPage2Red("Arial", 18, QFont::Bold);//普通红色
	QFont fontPage2SmallNormal("Arial", 12, QFont::Normal);//普通
	QFont fontPage2JiaCu("Arial", 18, QFont::Bold);//加粗
	QFont fontPage2SmallJiaCu("Arial", 14, QFont::Bold);//加粗
	QFont fontPage2Bold("Arial", 24, QFont::Bold);//加粗

	QString strTableCaption = "";

	//先根据是否有连续噪声、连续图像，赋值绘制类型
	int nDrawType = 0;//0:只绘制 红外 1:绘制红外+声音 2:绘制红外+声音+图像
	if (mapCotVoice.size() == 0 && mapCotImage.size() == 0)
	{
		nDrawType = 0;//只绘制红外
	}
	else if (mapCotVoice.size() > 0 && mapCotImage.size() == 0)
	{
		nDrawType = 1;//绘制红外+声音
	}
	else if(mapCotVoice.size() > 0 && mapCotImage.size() > 0)
	{
		nDrawType = 2;//红外+声音+图像
	}


	//先统计总数
	int nCount = 0;
	for (QMap<int, QVector<CPdfCotIrInfo>>::iterator i = mapCotIrInfo.begin(); i != mapCotIrInfo.end(); i++)
	{
		nCount += i.value().size();
	}


	//先计算A4纸是否满足 不然就要自定义高度
	if (nCount > 3)//信息列表大于3行,A4纸大小就不够了
	{
		//int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
		//int nPageHeightVal = 297 + (nCount * 7 - 21 + 1) * 11;//这个大小测试的适配成功
		//int nPageHeightVal = 297 + (nCount * 12 - 21 + 1) * 11;//这个大小测试的适配成功

		int nPageHeightVal = 297;
		switch (nDrawType)
		{
		case 0:
			nPageHeightVal = 297 + (nCount * 6 - 21 + 1) * 11;
			break;
		case 1:
			nPageHeightVal = 297 + (nCount * 7 - 21 + 1) * 11;
			break;
		case 2:
			nPageHeightVal = 297 + (nCount * 12 - 21 + 1) * 11;
			break;
		default:
			break;
		}

		//QSizeF pageSizeTemp(210, 1000);
		QSizeF pageSizeTemp(210, nPageHeightVal);
		printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
	}
	else
	{
		printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	}


	painter.setPen(penNormal);

	int nRowCount = 3;  // 表格行数
	int nColumnCount = 4;  // 表格列数
	int nCellWidth = 140;  // 单元格宽度
	int nCellHeight = 30;  // 单元格高度

	int cellStartX = 8;//表格起点坐标X

	//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	printer.newPage(); // 添加新的一页


	{
		// 绘制第一行合并的单元格
		QRect mergedCellRect(cellStartX, 60 - 40, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(mergedCellRect);  // 绘制单元格边框
		painter.drawText(mergedCellRect, Qt::AlignCenter, A2T("连续托辊检测"));  // 绘制单元格内容
	}
	

	// 绘制第二行标题栏
	int nRowTemporary = 2;//从2行开始
	nRowTemporary += 1;//因为第一行用了两行的高度，所有要+1
	for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
	{
		QRect cell_rect(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);
		painter.drawRect(cell_rect);  // 绘制单元格边框
		//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容


		if (nCol == 0)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));//米(托辊号)
		}
		else if (nCol == 1)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("测量值"));
		}
		else if (nCol == 2)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("状态"));
		}
		else if (nCol == 3)
		{
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_rect, Qt::AlignCenter, A2T("阈值"));
		}


	}
	nRowTemporary++;

	//遍历红外报警列表，往后继续绘制
	for (QMap<int, QVector<CPdfCotIrInfo>>::iterator i = mapCotIrInfo.begin(); i != mapCotIrInfo.end(); i++)
	{
		QVector<CPdfCotIrInfo> vecDataIr = i.value();
		QVector<CPdfCotVoiceInfo> vecDataVoice;
		QVector<CPdfCotImageInfo> vecDataImage;
		if (mapCotVoice.contains(i.key()))
		{
			vecDataVoice = mapCotVoice[i.key()];
		}
		if (mapCotImage.contains(i.key()))
		{
			vecDataImage = mapCotImage[i.key()];
		}

		//调用绘制一组函数
		drawGroupCot(nDrawType, nRowTemporary, vecDataIr, vecDataVoice, vecDataImage, painter);

#if 0
		for (int nAlmIndex = 0; nAlmIndex < vecDataIr.size(); nAlmIndex++)
		{
			//============红外测温
			//先绘制第一列合并上下两个单元格 位置
			QRect merged_cell_Temp1(cellStartX, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight * 12);//7倍的高度,因为还要多一行声音检测 + 5行可见光图片
			painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			QString sBelongTier = "";
			if (vecDataIr[nAlmIndex].nBelongTier == 0)
			{
				sBelongTier = A2T("上");
			}
			else
			{
				sBelongTier = A2T("下");
			}
			
			//QString sLoca = A2T("托辊:%1(%2m)").arg(vecData[nAlmIndex].m_sRollerDesc).arg(QString::number(vecData[nAlmIndex].m_dLocation, 'f', 1));
			QString sLoca = A2T("托辊:%1(%2)").arg(vecDataIr[nAlmIndex].m_sRollerDesc).arg(sBelongTier);
			painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sLoca);

			//绘制右侧的测量值、状态、备注这3个信息单元格
			painter.setFont(fontPage2Normal);
			//红外测温
			for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				if (nCol == 1)//测量值
				{
					if (0 == vecDataIr[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}


					painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("温度:最高") + QString::number(vecDataIr[nAlmIndex].m_doMeasurementVal) + A2T("℃"));
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 2)//状态
				{
					if (0 == vecDataIr[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}

					painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataIr[nAlmIndex].m_strAlmDesc);
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 3)//阈值
				{
					painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataIr[nAlmIndex].m_sRemark);
				}
			}
			//噪声
			for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				int nVoiceDataIndex = -1;

				for (int nInx = 0; nInx < vecDataVoice.size(); nInx++)
				{
					if (vecDataVoice[nInx].nBelongTier == vecDataIr[nAlmIndex].nBelongTier)
					{
						nVoiceDataIndex = nInx;
						break;
					}
				}


				if (nCol == 1)//测量值
				{
					if (nVoiceDataIndex == -1)
					{
						painter.setPen(penNormal);
						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));
					}
					else
					{
						if (0 == vecDataVoice[nVoiceDataIndex].m_nAlmState)
						{
							painter.setPen(penNormal);
						}
						else
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}


						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("噪声:") + QString::number(vecDataVoice[nVoiceDataIndex].m_dValue, 'f', 1) + A2T("dB"));
						painter.setPen(penNormal);//设置字体颜色恢复
					}

					
				}
				else if (nCol == 2)//状态
				{
					if (nVoiceDataIndex == -1)
					{
						painter.setPen(penNormal);
						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));
					}
					else
					{
						if (0 == vecDataVoice[nVoiceDataIndex].m_nAlmState)
						{
							painter.setPen(penNormal);
						}
						else
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataVoice[nVoiceDataIndex].m_strAlmDesc);
						painter.setPen(penNormal);//设置字体颜色恢复
					}
					
				}
				else if (nCol == 3)//阈值
				{
					if (nVoiceDataIndex == -1)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, ("/"));
					}
					else
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataVoice[nVoiceDataIndex].m_sRemark);
					}
					
				}
			}
			
			
			//绘制红外图片栏
			{
				
				QPixmap pixmapPic(vecDataIr[nAlmIndex].m_sPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 2) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

				//绘制图片备注栏
				QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 2) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
				painter.drawRect(mergedCellTemp);  // 绘制单元格边框

				painter.setFont(fontPage2SmallNormal);
				painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataIr[nAlmIndex].m_sPictureRemark);
				painter.setFont(fontPage2Normal);
			}
			//绘制图像图片栏
			{
				int nImageDataIndex = -1;

				for (int nInx = 0; nInx < vecDataImage.size(); nInx++)
				{
					if (vecDataImage[nInx].nBelongTier == vecDataIr[nAlmIndex].nBelongTier)
					{
						nImageDataIndex = nInx;
						break;
					}
				}

				if (nImageDataIndex == -1)
				{

				}
				else
				{
					//绘制图片栏
					QString sHttpPicUrl = vecDataImage[nImageDataIndex].m_sHttpPicAddr;
					CImageDownloader downPic(sHttpPicUrl);
					QPixmap pixmapNow;
					if (sHttpPicUrl.size() > 0)
					{
						downPic.getNewDlPixmap(pixmapNow);
					}
					painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 2 + 5) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapNow);
					
					//绘制图片备注栏
					QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 2 + 5) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
					painter.drawRect(mergedCellTemp);  // 绘制单元格边框

					painter.setFont(fontPage2SmallNormal);
					painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataImage[nImageDataIndex].m_sPictureRemark);
					painter.setFont(fontPage2Normal);
				}
				
			}


			nRowTemporary += 12;//在增加了5行图像相机
		}
#endif

	}
}

//画一组连续检测
void CPdfReport::drawGroupCot(int nDrawType, int &nRowTemporary, QVector<CPdfCotIrInfo> vecDataIr, QVector<CPdfCotVoiceInfo> vecDataVoice, QVector<CPdfCotImageInfo> vecDataImage, QPainter &painter)
{
	QPen penNormal(Qt::black, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色
	QPen penNormalRed(Qt::red, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常红色
	QPen penJiaCu(Qt::black, 3, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色加粗

	QFont fontPage2Normal("Arial", 18, QFont::Normal);//普通
	QFont fontPage2Red("Arial", 18, QFont::Bold);//普通红色
	QFont fontPage2SmallNormal("Arial", 12, QFont::Normal);//普通
	QFont fontPage2JiaCu("Arial", 18, QFont::Bold);//加粗
	QFont fontPage2SmallJiaCu("Arial", 14, QFont::Bold);//加粗
	QFont fontPage2Bold("Arial", 24, QFont::Bold);//加粗

	int nCellWidth = 140;  // 单元格宽度
	int nCellHeight = 30;  // 单元格高度
	int cellStartX = 8;//表格起点坐标X
	int nColumnCount = 4;  // 表格列数

	int nMergeCellsCnt = 6;//合并单元格格数
	switch (nDrawType)
	{
	case 0:
		nMergeCellsCnt = 6;
		break;
	case 1:
		nMergeCellsCnt = 7;
		break;
	case 2:
		nMergeCellsCnt = 12;
		break;
	default:
		break;
	}


	for (int nAlmIndex = 0; nAlmIndex < vecDataIr.size(); nAlmIndex++)
	{
		//============红外测温
		//先绘制第一列合并上下两个单元格 位置
		QRect merged_cell_Temp1(cellStartX, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight * nMergeCellsCnt);//6的红外,因为还要多一行声音检测 + 5行可见光图片
		painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
		painter.setFont(fontPage2JiaCu);
		QString sBelongTier = "";
		if (vecDataIr[nAlmIndex].nBelongTier == 0)
		{
			sBelongTier = A2T("上");
		}
		else
		{
			sBelongTier = A2T("下");
		}

		//QString sLoca = A2T("托辊:%1(%2m)").arg(vecData[nAlmIndex].m_sRollerDesc).arg(QString::number(vecData[nAlmIndex].m_dLocation, 'f', 1));
		QString sLoca = A2T("托辊:%1(%2)").arg(vecDataIr[nAlmIndex].m_sRollerDesc).arg(sBelongTier);
		painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sLoca);

		//绘制右侧的测量值、状态、备注这3个信息单元格
		painter.setFont(fontPage2Normal);
		//红外测温
		for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
		{
			QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);//150
			painter.drawRect(cell_rectTemp);// 绘制单元格边框

			if (nCol == 1)//测量值
			{
				if (0 == vecDataIr[nAlmIndex].m_nAlmState)
				{
					painter.setPen(penNormal);
				}
				else
				{
					painter.setPen(penNormalRed);//设置字体颜色为红色
				}


				painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("温度:最高") + QString::number(vecDataIr[nAlmIndex].m_doMeasurementVal) + A2T("℃"));
				painter.setPen(penNormal);//设置字体颜色恢复
			}
			else if (nCol == 2)//状态
			{
				if (0 == vecDataIr[nAlmIndex].m_nAlmState)
				{
					painter.setPen(penNormal);
				}
				else
				{
					painter.setPen(penNormalRed);//设置字体颜色为红色
				}

				painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataIr[nAlmIndex].m_strAlmDesc);
				painter.setPen(penNormal);//设置字体颜色恢复
			}
			else if (nCol == 3)//阈值
			{
				painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataIr[nAlmIndex].m_sRemark);
			}
		}
		
		//分类型绘制后面的
		if (nDrawType == 0)//只绘制红外
		{
			//绘制红外图片栏
			{

				QPixmap pixmapPic(vecDataIr[nAlmIndex].m_sPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

				//绘制图片备注栏
				QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
				painter.drawRect(mergedCellTemp);  // 绘制单元格边框

				painter.setFont(fontPage2SmallNormal);
				painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataIr[nAlmIndex].m_sPictureRemark);
				painter.setFont(fontPage2Normal);
			}


		}
		else if(nDrawType == 1)//红外+噪声
		{
			//绘制一行噪声
			{
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					int nVoiceDataIndex = -1;

					for (int nInx = 0; nInx < vecDataVoice.size(); nInx++)
					{
						if (vecDataVoice[nInx].nBelongTier == vecDataIr[nAlmIndex].nBelongTier)
						{
							nVoiceDataIndex = nInx;
							break;
						}
					}


					if (nCol == 1)//测量值
					{
						if (nVoiceDataIndex == -1)
						{
							painter.setPen(penNormal);
							painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));
						}
						else
						{
							if (0 == vecDataVoice[nVoiceDataIndex].m_nAlmState)
							{
								painter.setPen(penNormal);
							}
							else
							{
								painter.setPen(penNormalRed);//设置字体颜色为红色
							}


							painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("噪声:") + QString::number(vecDataVoice[nVoiceDataIndex].m_dValue, 'f', 1) + A2T("dB"));
							painter.setPen(penNormal);//设置字体颜色恢复
						}


					}
					else if (nCol == 2)//状态
					{
						if (nVoiceDataIndex == -1)
						{
							painter.setPen(penNormal);
							painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));
						}
						else
						{
							if (0 == vecDataVoice[nVoiceDataIndex].m_nAlmState)
							{
								painter.setPen(penNormal);
							}
							else
							{
								painter.setPen(penNormalRed);//设置字体颜色为红色
							}

							painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataVoice[nVoiceDataIndex].m_strAlmDesc);
							painter.setPen(penNormal);//设置字体颜色恢复
						}

					}
					else if (nCol == 3)//阈值
					{
						if (nVoiceDataIndex == -1)
						{
							painter.drawText(cell_rectTemp, Qt::AlignCenter, ("/"));
						}
						else
						{
							painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataVoice[nVoiceDataIndex].m_sRemark);
						}

					}
				}
			}

			//绘制红外图片栏
			{

				QPixmap pixmapPic(vecDataIr[nAlmIndex].m_sPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 2) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

				//绘制图片备注栏
				QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 2) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
				painter.drawRect(mergedCellTemp);  // 绘制单元格边框

				painter.setFont(fontPage2SmallNormal);
				painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataIr[nAlmIndex].m_sPictureRemark);
				painter.setFont(fontPage2Normal);
			}

			//绘制图像图片栏
			{
				int nImageDataIndex = -1;

				for (int nInx = 0; nInx < vecDataImage.size(); nInx++)
				{
					if (vecDataImage[nInx].nBelongTier == vecDataIr[nAlmIndex].nBelongTier)
					{
						nImageDataIndex = nInx;
						break;
					}
				}

				if (nImageDataIndex == -1)
				{

				}
				else
				{
					//绘制图片栏
					QString sHttpPicUrl = vecDataImage[nImageDataIndex].m_sHttpPicAddr;
					CImageDownloader downPic(sHttpPicUrl);
					QPixmap pixmapNow;
					if (sHttpPicUrl.size() > 0)
					{
						downPic.getNewDlPixmap(pixmapNow);
					}
					painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 2 + 5) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapNow);

					//绘制图片备注栏
					QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 2 + 5) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
					painter.drawRect(mergedCellTemp);  // 绘制单元格边框

					painter.setFont(fontPage2SmallNormal);
					painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataImage[nImageDataIndex].m_sPictureRemark);
					painter.setFont(fontPage2Normal);
				}

			}

		}
		else if (nDrawType == 2)//红外+噪声+图像
		{

			//绘制一行噪声
			{
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					int nVoiceDataIndex = -1;

					for (int nInx = 0; nInx < vecDataVoice.size(); nInx++)
					{
						if (vecDataVoice[nInx].nBelongTier == vecDataIr[nAlmIndex].nBelongTier)
						{
							nVoiceDataIndex = nInx;
							break;
						}
					}


					if (nCol == 1)//测量值
					{
						if (nVoiceDataIndex == -1)
						{
							painter.setPen(penNormal);
							painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));
						}
						else
						{
							if (0 == vecDataVoice[nVoiceDataIndex].m_nAlmState)
							{
								painter.setPen(penNormal);
							}
							else
							{
								painter.setPen(penNormalRed);//设置字体颜色为红色
							}


							painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("噪声:") + QString::number(vecDataVoice[nVoiceDataIndex].m_dValue, 'f', 1) + A2T("dB"));
							painter.setPen(penNormal);//设置字体颜色恢复
						}


					}
					else if (nCol == 2)//状态
					{
						if (nVoiceDataIndex == -1)
						{
							painter.setPen(penNormal);
							painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));
						}
						else
						{
							if (0 == vecDataVoice[nVoiceDataIndex].m_nAlmState)
							{
								painter.setPen(penNormal);
							}
							else
							{
								painter.setPen(penNormalRed);//设置字体颜色为红色
							}

							painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataVoice[nVoiceDataIndex].m_strAlmDesc);
							painter.setPen(penNormal);//设置字体颜色恢复
						}

					}
					else if (nCol == 3)//阈值
					{
						if (nVoiceDataIndex == -1)
						{
							painter.drawText(cell_rectTemp, Qt::AlignCenter, ("/"));
						}
						else
						{
							painter.drawText(cell_rectTemp, Qt::AlignCenter, vecDataVoice[nVoiceDataIndex].m_sRemark);
						}

					}
				}
			}

			//绘制红外图片栏
			{

				QPixmap pixmapPic(vecDataIr[nAlmIndex].m_sPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 2) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

				//绘制图片备注栏
				QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 2) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
				painter.drawRect(mergedCellTemp);  // 绘制单元格边框

				painter.setFont(fontPage2SmallNormal);
				painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataIr[nAlmIndex].m_sPictureRemark);
				painter.setFont(fontPage2Normal);
			}

			//绘制图像图片栏
			{
				int nImageDataIndex = -1;

				for (int nInx = 0; nInx < vecDataImage.size(); nInx++)
				{
					if (vecDataImage[nInx].nBelongTier == vecDataIr[nAlmIndex].nBelongTier)
					{
						nImageDataIndex = nInx;
						break;
					}
				}

				if (nImageDataIndex == -1)
				{

				}
				else
				{
					//绘制图片栏
					QString sHttpPicUrl = vecDataImage[nImageDataIndex].m_sHttpPicAddr;
					CImageDownloader downPic(sHttpPicUrl);
					QPixmap pixmapNow;
					if (sHttpPicUrl.size() > 0)
					{
						downPic.getNewDlPixmap(pixmapNow);
					}
					painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 2 + 5) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapNow);

					//绘制图片备注栏
					QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 2 + 5) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
					painter.drawRect(mergedCellTemp);  // 绘制单元格边框

					painter.setFont(fontPage2SmallNormal);
					painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, vecDataImage[nImageDataIndex].m_sPictureRemark);
					painter.setFont(fontPage2Normal);
				}

			}

		}
		
		nRowTemporary += nMergeCellsCnt;
	}
}

//输出pdf报表信息(机器人巡检任务)
bool CPdfReport::outputPdfReportInfo(CPdfReportInfo CRobData, QString &sErrMsg)
{
	// 创建一个QPrinter对象
	QPrinter printer(QPrinter::PrinterResolution);
	printer.setOutputFormat(QPrinter::PdfFormat);
	printer.setOutputFileName(CRobData.m_strOutputPdfFolder);// 设置输出路径
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4

	// 创建一个QPainter对象，并将其与QPrinter关联起来
	QPainter painter;
	if (!painter.begin(&printer))
	{
		sErrMsg = A2T("QPainter begin 失败");
		return false;
	}

	//基础信息
	QPen penNormal(Qt::black, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色
	QPen penNormalRed(Qt::red, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常红色
	QPen penJiaCu(Qt::black, 3, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色加粗
	painter.setPen(penNormal);


	//====================绘制第一页的标题和图片等基础信息================
	int titleHeight = printer.height() / 3; // 标题区域高度
	//第一行标题 显示"大唐南京发电厂"
	QFont font1("Arial", 30, QFont::Normal);
	painter.setFont(font1);
	QRect titleRect1(0, 0, printer.width(), titleHeight / 2);
	painter.drawText(titleRect1, Qt::AlignCenter, CRobData.m_trClientCompanyNameTemp);//客户公司名称

	//第二行标题 紧接着下面显示"皮带巡检机器人巡检报告"
	QFont font2("Arial", 40, QFont::Bold);
	painter.setFont(font2);
	QRect titleRect2(0, 60, printer.width(), titleHeight / 2);
	painter.drawText(titleRect2, Qt::AlignCenter, A2T("皮带巡检机器人巡检报告"));

	//紧接着加载一张机器人图片
	QImage image(":/icon/Rob/Device.png"); // 替换为您的图片文件路径
	QRectF imageRect((printer.width() - image.width()) / 2, (printer.height() - image.height()) / 2, image.width(), image.height());
	painter.drawImage(imageRect, image);

	//紧接着显示公司"南京科远智慧科技集团股份有限公司"
	QFont font3("Arial", 25, QFont::Normal);
	int nBottomMargin = printer.height() / 5;
	painter.setFont(font3);
	QRectF companyRect(0, printer.height() - nBottomMargin - 10, printer.width(), nBottomMargin / 2);
	painter.drawText(companyRect, Qt::AlignCenter, A2T("南京科远智慧科技集团股份有限公司"));

	//紧接着显示日期 "2023年11月8日"
	painter.setFont(font3);
	QRectF dateRect(0, printer.height() - nBottomMargin / 2 - 25, printer.width(), nBottomMargin / 2);
	QString strCurrReportTime = QDateTime::currentDateTime().toString("yyyy/MM/dd");
	painter.drawText(dateRect, Qt::AlignCenter, strCurrReportTime);

	//====================绘制第二页的表格(报告综述)===============
	int nRowCount = 9;  // 表格行数
	int nColumnCount = 4;  // 表格列数

	int nCellWidth = 140;  // 单元格宽度
	int nCellHeight = 30;  // 单元格高度

	//先计算A4纸是否满足 不然就要自定义高度
	if (CRobData.m_vecAbnormalBriefList.size() > 15)//异常信息列表大于15行,A4纸大小就不够了
	{
		int nPageHeight = 297 + (CRobData.m_vecAbnormalBriefList.size() - 15 + 1) * 11;//这个大小测试的适配成功
		//QSizeF pageSizeTemp(210, 1000);
		QSizeF pageSizeTemp(210, nPageHeight);
		printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
	}
	else
	{
		printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	}

	printer.newPage(); // 添加新的一页

	int nWordRightSkewing = 3;//文字向右偏移量(居中对齐不需要,只有左对齐需要，不然会和表格左侧重叠)

	QFont fontPage2Normal("Arial", 18, QFont::Normal);//普通
	QFont fontPage2Red("Arial", 18, QFont::Bold);//普通红色
	QFont fontPage2SmallNormal("Arial", 12, QFont::Normal);//普通
	QFont fontPage2JiaCu("Arial", 18, QFont::Bold);//加粗
	QFont fontPage2SmallJiaCu("Arial", 13, QFont::Bold);//加粗
	QFont fontPage2Bold("Arial", 24, QFont::Bold);//加粗
	painter.setFont(fontPage2Bold);

	int cellStartX = 8;//表格起点坐标X

	QString strTableCaption = A2T("%1报告综述").arg(CRobData.m_strRobotName);//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

	// 绘制第一行合并的单元格
	QRect merged_cell_rectddd(cellStartX, 60, nCellWidth * 4, nCellHeight *2);//高度占2行
	painter.drawRect(merged_cell_rectddd);  // 绘制单元格边框
	painter.drawText(merged_cell_rectddd, Qt::AlignCenter, CRobData.m_strRobotName);  // 绘制单元格内容

	// 绘制后面的单元格
	painter.setFont(fontPage2Normal);
	for (int nRow = 1; nRow < nRowCount; nRow++)
	{
		if (nRow == 1 || nRow == 2 || nRow == 8)  //  第二行、第三行和第九行  先合并后面3列
		{
			QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow+1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
			if (nRow == 1)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRobData.m_strTaskName);//任务名称
			}
			else if (nRow == 2)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRobData.m_strTaskTime);//巡检日期
			}
			else if (nRow == 8)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRobData.m_strComment);//备注为空
			}

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				
				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				if (nRow == 1)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检任务"));
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检日期"));
				}
				else if (nRow == 8)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
				}
			}
		}
		else // 其他普通单元格是4列的
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

				if (nRow == 3)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("开始时间"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, QDateTime::fromString(CRobData.m_strTaskStartTime,"yyyy-MM-dd hh:mm:ss").toString("hh:mm:ss"));
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("结束时间"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, QDateTime::fromString(CRobData.m_strTaskEndTime, "yyyy-MM-dd hh:mm:ss").toString("hh:mm:ss"));
					}
				}
				else if (nRow == 4)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("开始电量(%)"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strTaskStartElectricalValue);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("结束电量(%)"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strTaskEndElectricalValue);
					}
				}
				else if (nRow == 5)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("任务状态"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						if (CRobData.m_strTaskState == A2T("未完成"))//任务执行状态未完成的红色标出
						{
							painter.setPen(penNormalRed);
						}
						else
						{
							painter.setPen(penNormal);
						}
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strTaskState);
						painter.setPen(penNormal);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("合格率"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strPercentOfPass);
					}
				}
				else if (nRow == 6)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检点数量"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionPointCount);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项数量"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemCount);
					}

				}
				else if (nRow == 7)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项正常项数"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemNormalCount);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项异常项数"));
					}
					else if (nCol == 3)
					{
						if (CRobData.m_nInspectionItemAbnormalCount > 0)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色

							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemAbnormalCount);

							painter.setPen(penNormal);// 设置字体恢复
						}
						else
						{
							painter.setPen(penNormal);// 设置字体恢复

							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemAbnormalCount);
						}
											
					}

				}
				
			}
		}
	}
	//后面加上异常项简要信息列表,有几项，增加几行
	int nVecAbnormalBriefCount = CRobData.m_vecAbnormalBriefList.size();
	if (nVecAbnormalBriefCount > 0)
	{
		int nRowNowHa = nRowCount + 1;//这里是从第9行开始
		//先绘制第一列合并单元格
		QRect merged_cell_TempHa(cellStartX, 60 + nRowNowHa * nCellHeight, nCellWidth, nCellHeight * nVecAbnormalBriefCount);//异常个数 倍的高度
		painter.drawRect(merged_cell_TempHa);  // 绘制单元格边框
		painter.setFont(fontPage2JiaCu);
		painter.drawText(merged_cell_TempHa, Qt::AlignCenter, A2T("异常项简要信息"));

		//再绘制后面的每行详细信息
		for (int nTempIndex = 0; nTempIndex < nVecAbnormalBriefCount; nTempIndex++)
		{
			
			QRect merged_cell_rectHei(cellStartX + nCellWidth, 60 + (nRowNowHa + nTempIndex) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rectHei);  // 绘制单元格边框

			//文字的区域要加上向右偏移量
			QRect merged_cell_WordrectHei(cellStartX + nWordRightSkewing + nCellWidth, 60 + (nRowNowHa + nTempIndex) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.setFont(fontPage2Normal); 
			painter.setPen(penNormalRed);//设置字体颜色为红色
			painter.drawText(merged_cell_WordrectHei, Qt::AlignLeft | Qt::AlignVCenter, CRobData.m_vecAbnormalBriefList[nTempIndex]);
			painter.setPen(penNormal);//设置字体颜色为恢复
		}
		
		
		
	}
	
	//这一页的表格周围大的一圈，需要加粗
	painter.setPen(penJiaCu);
	QRect merged_cell_rectDaQuan(cellStartX, 60, nCellWidth * 4, nCellHeight * (10 + nVecAbnormalBriefCount));
	painter.drawRect(merged_cell_rectDaQuan);  // 绘制加粗的单元格边框

#if 0
	//====================绘制第三页的表格(连续检测综述)===============
	painter.setPen(penNormal);
	nRowCount = 3;  // 表格行数
	nColumnCount = 4;  // 表格列数

	nCellWidth = 140;  // 单元格宽度
	nCellHeight = 30;  // 单元格高度

	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	printer.newPage(); // 添加新的一页

	painter.setFont(fontPage2Bold);
	strTableCaption = A2T("连续检测报告综述");//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

	// 绘制第一行合并的单元格
	QRect merged_cell_rectBelt(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
	painter.drawRect(merged_cell_rectBelt);  // 绘制单元格边框
	painter.drawText(merged_cell_rectBelt, Qt::AlignCenter, A2T("连续检测"));  // 绘制单元格内容

	// 绘制后面的单元格
	painter.setFont(fontPage2Normal);
	for (int nRow = 1; nRow < nRowCount; nRow++)
	{
		if (nRow == 1 || nRow == 2)  //  第二行、第三行 先合并后面3列
		{
			QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
			if (nRow == 1)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRobData.m_VecCotIrInfo.size()));//红外报警数
			}
			else if (nRow == 2)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRobData.m_VecCotVoiceInfo.size()));//噪声报警数

			}
			

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				if (nRow == 1)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("红外报警数"));
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("噪声报警数"));
				}
				
			}
		}
		else
		{
			//暂无其他
		}
	}
	//这一页的表格周围大的一圈，需要加粗
	painter.setPen(penJiaCu);
	QRect merged_cell_rectDaQuan2(cellStartX, 60, nCellWidth * 4, nCellHeight * 4);
	painter.drawRect(merged_cell_rectDaQuan2);  // 绘制加粗的单元格边框
#endif

	//===================绘制后面页的巡检点表格(一个点一页，绘制一个表格)===============
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	painter.setPen(penNormal);
	//遍历巡检点Vec容器
	for (int nPointIndex = 0; nPointIndex < CRobData.m_vecFormInspectionPointInfo.size(); nPointIndex++)
	{
		if (0 == CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo.size())
		{
			continue;//这个点没有已执行的巡检项,则跳过绘制这个点
		}

		//根据云台巡检项的个数判断A4纸是否够用
		int nYtItemsCount = 0;
		for (int j = 0; j < CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo.size(); j++)
		{
			if (CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo[j].emPdfOutItemType == EmPdfOutItemTypeDef::EN_InfraredThermometry 
				|| CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo[j].emPdfOutItemType == EmPdfOutItemTypeDef::EN_PhotoGraph)
			{
				nYtItemsCount++;
			}
		}
		if (nYtItemsCount > 2)//云台巡检项的个数大于2个 A4纸大小就不够了
		{
			int nPageHeight = 297 + (nYtItemsCount - 2) * 11 * 6;//这个大小测试的适配成功
			//QSizeF pageSizeTemp(210, 1000);
			QSizeF pageSizeTemp(210, nPageHeight);
			printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
		}
		else
		{
			printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		}

		printer.newPage();//添加新的一页

		painter.setPen(penNormal);

		int nCellStartXPo = 8;//表格起点坐标X

		painter.setFont(fontPage2Bold);

		QString strTableCaption = "";
		if (CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_sRollerDesc.size() < 1)
		{
			//strTableCaption = A2T("巡检点%1").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
			strTableCaption = A2T("%1").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
		}
		else
		{
			//strTableCaption = A2T("托辊%1(巡检点%2)").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_sRollerDesc).arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
			strTableCaption = A2T("%1").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
		}

		painter.drawText(nCellStartXPo, 20, strTableCaption); // 表格标题 (巡检点 + 巡检点名称) 100

		int nRowCount = 4;  // 表格行数
		int nColumnCount = 4;  // 表格列数

		int nCellWidthPo = 140;  // 单元格宽度
		int nCellHeightPo = 30;  // 单元格高度


		// 绘制第一行合并的单元格
		QRect merged_cell_rect_Po(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 2);//150
		painter.drawRect(merged_cell_rect_Po);  // 绘制单元格边框
		painter.drawText(merged_cell_rect_Po, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strRobotName);  // 绘制单元格内容 (机器人名称)

		// 绘制后面的第2、3、4行单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < nRowCount; nRow++)
		{
			if (nRow == 1 || nRow == 2 || nRow == 3)
			{
				for (int nCol = 0; nCol < nColumnCount; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidthPo, 40 + (nRow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					if (nRow == 1)
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检点"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strLocation);
						}
					}
					else if (nRow == 2)
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检日期"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectDate);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检时间"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectTime);
						}
					}
					else if (nRow == 3)
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("测量值"));
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("状态"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("阈值"));
						}
					}
				}
			}
			
		}


		//遍历巡检项，往表格下面接着开始绘制
		int nRowTempNow = 4;//从4行开始
		nRowTempNow += 1;//因为第一行用了两行的高度，所有要+1
		QVector<CPdfOutInspecItemInfoAll> vecInspecItemsInfoTemp = CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo;
		int nItemsCount = vecInspecItemsInfoTemp.size();//巡检项个数
		for (int i = 0; i < nItemsCount; i++)
		{
			switch (vecInspecItemsInfoTemp[i].emPdfOutItemType)
			{
			case EmPdfOutItemTypeDef::EN_None:
			{
				//无 不用绘制
			}
			break;
			case EmPdfOutItemTypeDef::EN_PM25:
			{
				//============PM2.5
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("PM2.5"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);


						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{


						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色
						}


						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_PM10:
			{
				//============PM10
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("PM10"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);


						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{


						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色
						}


						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Co:
			{
				//============一氧化碳
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("一氧化碳"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}
						
						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);


						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						

						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色
						}
						

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}
				


				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_CombustibleGas:
			{
				//============可燃气体
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("可燃气体"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Temperature:
			{
				//============温度
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("温度"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Humidity:
			{
				//============湿度
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("湿度"));
						
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{

						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Voice:
			{
				//============声音
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("声音"));

					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{

						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_InfraredThermometry:
			{
				//============红外测温
				//先绘制第一列合并上下两个单元格
				QRect merged_cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo *6);//6倍的高度,因为要放图片 150
				painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
				painter.setFont(fontPage2JiaCu);
				QString sIrName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
				painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sIrName);
				//painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("红外测温"));

				//绘制右侧的测量值、状态、备注这3个信息单元格
				painter.setFont(fontPage2Normal);
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("最高") + QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}

				//绘制图片栏
				//QPixmap *pPixmapA = new QPixmap(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				QPixmap PixmapA(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow+1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), PixmapA);

				//绘制图片备注栏
				QRect merged_cell_TempCC(cellStartX + 3 * nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo * 5);
				painter.drawRect(merged_cell_TempCC);  // 绘制单元格边框
				painter.setFont(fontPage2SmallNormal);
				painter.drawText(merged_cell_TempCC, Qt::TextWordWrap | Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strPictureRemark);
				painter.setFont(fontPage2Normal);
				nRowTempNow += 6;
			}
			break;
			case EmPdfOutItemTypeDef::EN_PhotoGraph:
			{
				//============图像相机
				//先绘制第一列合并上下两个单元格
				QRect merged_cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo * 6);//6倍的高度,因为要放图片 150
				painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
				painter.setFont(fontPage2JiaCu);
				QString sVisName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
				painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sVisName);
				//painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("图像相机"));

				//绘制右侧的测量值、状态、备注这3个信息单元格
				painter.setFont(fontPage2Normal);
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}

				}

				//绘制图片栏(这里用http图片)
				//QPixmap PixmapHttp(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				//painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), PixmapHttp);
				{
					QString sHttpPicUrl = vecInspecItemsInfoTemp[i].m_sHttpPicAddr;
					CImageDownloader downPic(sHttpPicUrl);
					QPixmap pixmapNow;
					if (sHttpPicUrl.size() > 0)
					{
						downPic.getNewDlPixmap(pixmapNow);
					}
					painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), pixmapNow);
				}


				//绘制图片备注栏
				QRect merged_cell_Temp_Http(cellStartX + 3 * nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo * 5);
				painter.drawRect(merged_cell_Temp_Http);  // 绘制单元格边框
				painter.drawText(merged_cell_Temp_Http, Qt::TextWordWrap | Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strPictureRemark);//这个备注长，需要自动换行

				nRowTempNow += 6;

			}
			break;
#if 0
			case EmPdfOutItemTypeDef::EN_BeltOffTrack:
			{
				//============皮带跑偏
				//先绘制第一列合并上下两个单元格
				QRect merged_cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo * 6);//6倍的高度,因为要放图片 150
				painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
				painter.setFont(fontPage2JiaCu);
				painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("皮带跑偏"));

				//绘制右侧的测量值、状态、备注这3个信息单元格
				painter.setFont(fontPage2Normal);
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					if (nCol == 1)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);
					}
					else if (nCol == 2)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);
					}
					else if (nCol == 3)
					{
						//这一栏不填
					}
				}

				//绘制图片栏
				//QPixmap *pPixmapA = new QPixmap(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				QPixmap PixmapA(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), PixmapA);

				//绘制图片备注栏
				QRect merged_cell_TempCC(cellStartX + 3 * nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo * 5);
				painter.drawRect(merged_cell_TempCC);  // 绘制单元格边框
				painter.drawText(merged_cell_TempCC, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);

				nRowTempNow += 6;
			}
			break;
#endif
			
			default:
				break;
			}
		}

		//往表格下面接着 绘制一行备注
		{
			QRect cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);
			painter.drawRect(cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_Temp1, Qt::AlignCenter, A2T("备注"));


			QRect cell_Temp2(cellStartX + 1 * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo);
			painter.drawRect(cell_Temp2);  // 绘制单元格边框
			painter.setFont(fontPage2Normal);
			painter.drawText(cell_Temp2, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strRemark);

			nRowTempNow++;
		}


		//绘制两个表格周围的加粗框
		painter.setPen(penJiaCu);
		//1
		QRect merged_cell_rectDaQuanA(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 4);
		painter.drawRect(merged_cell_rectDaQuanA);  // 绘制加粗的单元格边框
		//2
		int ntDaQuanBRows = nRowTempNow - 4;
		QRect merged_cell_rectDaQuanB(nCellStartXPo, 40 + 4 * nCellHeightPo, nCellWidthPo * 4, nCellHeightPo * ntDaQuanBRows);
		painter.drawRect(merged_cell_rectDaQuanB);  // 绘制加粗的单元格边框

		#if 0
		//准备做穿插连续检测结果(现在取消穿插了)
		//然后查找该点和下一个点之间,有多少连续检测数据
		int nStartRoller = CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_nRollerCode;
		int nEndRoller = 0;
		if (CRobData.m_vecFormInspectionPointInfo.size() > (nPointIndex + 1))
		{
			nEndRoller = CRobData.m_vecFormInspectionPointInfo[nPointIndex + 1].m_nRollerCode;
		}
		else
		{
			//是最后一个点
			nEndRoller += 100000;
		}
		QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfo;//连续红外结果数组
		QMap<int, QVector<CPdfCotVoiceInfo>> mapCotVoiceInfo;//连续声音结果数组 <托辊号, 结果>
		getBetwTwoRollerCotData(nStartRoller, nEndRoller, mapCotIrInfo, mapCotVoiceInfo, CRobData.m_VecCotIrInfo, CRobData.m_VecCotVoiceInfo);
		//绘制新一页连续红外
		if (mapCotIrInfo.size() > 0)
		{
			drawNewPageCotIr(mapCotIrInfo, painter, printer);
		}
		//绘制一页连续噪声(先删掉)
		#endif
	}

	//=====================连续噪声监测报警详情列表(暂时不显示)====================//
#if 0
	if (CRobData.m_VecCotVoiceInfo.size() > 0)
	{

		//先计算A4纸是否满足 不然就要自定义高度
		if (CRobData.m_VecCotVoiceInfo.size() > 21)//异常信息列表大于21行,A4纸大小就不够了
		{
			//int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
			int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
			//QSizeF pageSizeTemp(210, 1000);
			QSizeF pageSizeTemp(210, nPageHeightVal);
			printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
		}
		else
		{
			printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		}

		painter.setPen(penNormal);
		nRowCount = 3;  // 表格行数
		nColumnCount = 4;  // 表格列数

		nCellWidth = 140;  // 单元格宽度
		nCellHeight = 30;  // 单元格高度


		//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		printer.newPage(); // 添加新的一页

		painter.setFont(fontPage2Bold);
		strTableCaption = A2T("连续噪声检测详细描述");//这个要加粗
		painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

		// 绘制第一行合并的单元格
		QRect merged_cell_rectVoice(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectVoice);  // 绘制单元格边框
		painter.drawText(merged_cell_rectVoice, Qt::AlignCenter, A2T("噪声检测"));  // 绘制单元格内容

		// 绘制第二行标题栏
		int nRowTemporary = 2;//从2行开始
		nRowTemporary += 1;//因为第一行用了两行的高度，所有要+1
		for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
		{
			QRect cell_rect(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight, nCellWidth, nCellHeight);
			painter.drawRect(cell_rect);  // 绘制单元格边框
			//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容


			if (nCol == 0)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));//米(托辊号)
			}
			else if (nCol == 1)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("噪声值"));
			}
			else if (nCol == 2)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警描述"));
			}
			else if (nCol == 3)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
			}


		}
		nRowTemporary++;

		//遍历噪声报警列表，往后继续绘制
		for (int nAlmIndex = 0; nAlmIndex < CRobData.m_VecCotVoiceInfo.size(); nAlmIndex++)
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				painter.setFont(fontPage2Normal);

				if (nCol == 0)//位置
				{
					QString sLoca = A2T("%1m(托辊:%2)").arg(QString::number(CRobData.m_VecCotVoiceInfo[nAlmIndex].m_dLocation, 'f', 1)).arg(CRobData.m_VecCotVoiceInfo[nAlmIndex].m_sRollerDesc);
					painter.drawText(cell_rectTemp, Qt::AlignCenter, sLoca);
				}
				else if (nCol == 1)//噪声值
				{
					painter.setPen(penNormalRed);//设置字体颜色为红色
					painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(CRobData.m_VecCotVoiceInfo[nAlmIndex].m_dValue, 'f', 1));
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 2)//报警描述
				{
					painter.setPen(penNormalRed);//设置字体颜色为红色
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotVoiceInfo[nAlmIndex].m_strAlmDesc);
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 3)//备注
				{
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotVoiceInfo[nAlmIndex].m_sRemark);
				}
			}



			nRowTemporary++;
		}
	}
#endif

	//=====================连续红外监测报警详情列表====================//
	{
		//QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfo;//连续红外结果数组
		//getCotMapIrData(mapCotIrInfo, CRobData.m_VecCotIrInfo);
		//drawNewPageCotIr(mapCotIrInfo, painter, printer);
	}

	//=====================连续检测详情列表(连续红外和连续噪声在一起显示)====================//
	QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfo;//连续红外结果数组
	getCotMapIrData(mapCotIrInfo, CRobData.m_VecCotIrInfo);
	QMap<int, QVector<CPdfCotVoiceInfo>> mapCotVoiceInfo;//连续声音结果数组
	getCotMapVoiceData(mapCotVoiceInfo, CRobData.m_VecCotVoiceInfo);
	QMap<int, QVector<CPdfCotImageInfo>> mapCotImageInfo;//连续图像结果数组
	getCotMapImageData(mapCotImageInfo, CRobData.m_VecCotImageInfo);
	//一来一回会有两个相同的托辊号 QVector中有两个数据 红外、声音、图像都是两个
	calculateCotRetBelongTier(mapCotIrInfo, mapCotVoiceInfo, mapCotImageInfo);//计算连续检测结果归属层级
	//绘制新的一个连续红外+连续声音在一起
	drawNewPageCotAll(mapCotIrInfo, mapCotVoiceInfo, mapCotImageInfo, painter, printer);
#if 0
	//这个没重新按托辊号排序,不要了
	if (CRobData.m_VecCotIrInfo.size() > 0)
	{

		//先计算A4纸是否满足 不然就要自定义高度
		if (CRobData.m_VecCotIrInfo.size() > 3)//异常信息列表大于3行,A4纸大小就不够了
		{
			//int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
			int nPageHeightVal = 297 + (CRobData.m_VecCotIrInfo.size()*6 - 21 + 1) * 11;//这个大小测试的适配成功
			//QSizeF pageSizeTemp(210, 1000);
			QSizeF pageSizeTemp(210, nPageHeightVal);
			printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
		}
		else
		{
			printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		}


		painter.setPen(penNormal);
		nRowCount = 3;  // 表格行数
		nColumnCount = 4;  // 表格列数

		nCellWidth = 140;  // 单元格宽度
		nCellHeight = 30;  // 单元格高度


		//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		printer.newPage(); // 添加新的一页

#if 0
		//这个标题暂时不要了
		painter.setFont(fontPage2Bold);
		strTableCaption = A2T("连续红外检测详细描述");//这个要加粗
		painter.drawText(cellStartX, 40, strTableCaption); // 表格标题
#endif

		// 绘制第一行合并的单元格
		QRect merged_cell_rectVoice(cellStartX, 60 - 40, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectVoice);  // 绘制单元格边框
		painter.drawText(merged_cell_rectVoice, Qt::AlignCenter, A2T("连续托辊检测"));  // 绘制单元格内容

		// 绘制第二行标题栏
		int nRowTemporary = 2;//从2行开始
		nRowTemporary += 1;//因为第一行用了两行的高度，所有要+1
		for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
		{
			QRect cell_rect(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);
			painter.drawRect(cell_rect);  // 绘制单元格边框
			//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容


			if (nCol == 0)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));//米(托辊号)
			}
			else if (nCol == 1)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("测量值"));
			}
			else if (nCol == 2)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("状态"));
			}
			else if (nCol == 3)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("阈值"));
			}


		}
		nRowTemporary++;

		//遍历红外报警列表，往后继续绘制
		for (int nAlmIndex = 0; nAlmIndex < CRobData.m_VecCotIrInfo.size(); nAlmIndex++)
		{
			//============红外测温
			//先绘制第一列合并上下两个单元格 位置
			QRect merged_cell_Temp1(cellStartX, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight * 6);//6倍的高度,因为要放图片 150
			painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			QString sLoca = A2T("托辊:%1(%2m)").arg(CRobData.m_VecCotIrInfo[nAlmIndex].m_sRollerDesc).arg(QString::number(CRobData.m_VecCotIrInfo[nAlmIndex].m_dLocation, 'f', 1));
			painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sLoca);

			//绘制右侧的测量值、状态、备注这3个信息单元格
			painter.setFont(fontPage2Normal);
			for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				if (nCol == 1)//测量值
				{
					if (0 == CRobData.m_VecCotIrInfo[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}
					
					painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("最高") + QString::number(CRobData.m_VecCotIrInfo[nAlmIndex].m_doMeasurementVal) + A2T("℃"));
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 2)//状态
				{
					if (0 == CRobData.m_VecCotIrInfo[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}
					
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotIrInfo[nAlmIndex].m_strAlmDesc);
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 3)//备注
				{
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotIrInfo[nAlmIndex].m_sRemark);
				}
			}

			//绘制图片栏
			QPixmap pixmapPic(CRobData.m_VecCotIrInfo[nAlmIndex].m_sPictureAddress);
			painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

			//绘制图片备注栏
			QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
			painter.drawRect(mergedCellTemp);  // 绘制单元格边框
			
			painter.setFont(fontPage2SmallNormal);
			painter.drawText(mergedCellTemp, Qt::TextWordWrap | Qt::AlignCenter, CRobData.m_VecCotIrInfo[nAlmIndex].m_sPictureRemark);
			painter.setFont(fontPage2Normal);
			nRowTemporary += 6;
		}
	}
#endif


	// 结束绘制
	if (!painter.end())
	{
		sErrMsg = A2T("QPainter end 失败");
		return false;
	}

	return true;
}

//输出综合性报表(机器人巡检任务、纠偏、撕裂)
bool CPdfReport::outputSynthPdfRptInfo(CPdfReportInfo CRobData, CPdfRectifyInfo &CRectifyData, CPdfTearInfo &CTearData, CPdfExtraAiInfo &CExtraAiInfo, QString &sErrMsg)
{
	// 创建一个QPrinter对象
	QPrinter printer(QPrinter::PrinterResolution);
	printer.setOutputFormat(QPrinter::PdfFormat);
	printer.setOutputFileName(CRobData.m_strOutputPdfFolder);// 设置输出路径
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4

	// 创建一个QPainter对象，并将其与QPrinter关联起来
	QPainter painter;
	if (!painter.begin(&printer))
	{
		sErrMsg = A2T("QPainter begin 失败");
		return false;
	}

	//基础信息
	QPen penNormal(Qt::black, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色
	QPen penNormalRed(Qt::red, 1, Qt::SolidLine);// 设置边框的颜色和宽度 正常红色
	QPen penJiaCu(Qt::black, 3, Qt::SolidLine);// 设置边框的颜色和宽度 正常黑色加粗
	painter.setPen(penNormal);

	//====================绘制第一页的标题和图片等基础信息================
	int nTitleHeight = printer.height() / 3; // 标题区域高度
	//第一行标题 显示"大唐南京发电厂"
	QFont font1("Arial", 30, QFont::Normal);
	painter.setFont(font1);
	QRect titleRect1(0, 0, printer.width(), nTitleHeight / 2);
	painter.drawText(titleRect1, Qt::AlignCenter, CRobData.m_trClientCompanyNameTemp);//客户公司名称

	//第二行标题 紧接着下面显示"皮带巡检综合报告"
	QFont font2("Arial", 40, QFont::Bold);
	painter.setFont(font2);
	QRect titleRect2(0, 60, printer.width(), nTitleHeight / 2);
	painter.drawText(titleRect2, Qt::AlignCenter, A2T("皮带巡检综合报告"));

	//紧接着加载一张新版机器人图片
	QImage image(":/icon/Rob/Device.png"); //替换为图片文件路径
	QRectF imageRect((printer.width() - image.width()) / 2, (printer.height() - image.height()) / 2, image.width(), image.height());
	painter.drawImage(imageRect, image);

	//紧接着显示公司示例"南京科远智慧科技集团股份有限公司"
	QFont font3("Arial", 25, QFont::Normal);
	int nBottomMargin = printer.height() / 5;
	painter.setFont(font3);
	QRectF companyRect(0, printer.height() - nBottomMargin - 10, printer.width(), nBottomMargin / 2);
	painter.drawText(companyRect, Qt::AlignCenter, A2T("南京科远智慧科技集团股份有限公司"));

	//紧接着显示日期示例 "2024/05/11"
	painter.setFont(font3);
	QRectF dateRect(0, printer.height() - nBottomMargin / 2 - 25, printer.width(), nBottomMargin / 2);
	QString strCurrReportTime = QDateTime::currentDateTime().toString("yyyy/MM/dd");
	painter.drawText(dateRect, Qt::AlignCenter, strCurrReportTime);

	//====================绘制第二页的表格(机器人任务报告综述)===============
	int nRowCount = 9;  // 表格行数
	int nColumnCount = 4;  // 表格列数

	int nCellWidth = 140;  // 单元格宽度
	int nCellHeight = 30;  // 单元格高度

	//先计算A4纸是否满足 不然就要自定义高度
	if (CRobData.m_vecAbnormalBriefList.size() > 2)//异常信息列表大于15行,A4纸大小就不够了
	{
		int nPageHeight = 297 + (CRobData.m_vecAbnormalBriefList.size() - 2 + 8) * 11;//这个大小测试的适配成功
		//QSizeF pageSizeTemp(210, 1000);
		QSizeF pageSizeTemp(210, nPageHeight);
		printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
	}
	else
	{
		//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4

		int nPageHeight = 297 +  8 * 11;//这个大小测试的适配成功
		//QSizeF pageSizeTemp(210, 1000);
		QSizeF pageSizeTemp(210, nPageHeight);
		printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
	}

	printer.newPage(); // 添加新的一页

	int nWordRightSkewing = 3;//文字向右偏移量(居中对齐不需要,只有左对齐需要，不然会和表格左侧重叠)

	QFont fontPage2Normal("Arial", 18, QFont::Normal);//普通
	QFont fontPage2Red("Arial", 18, QFont::Bold);//普通红色
	QFont fontPage2SmallNormal("Arial", 12, QFont::Normal);//普通
	QFont fontPage2JiaCu("Arial", 18, QFont::Bold);//加粗
	QFont fontPage2SmallJiaCu("Arial", 13, QFont::Bold);//加粗
	QFont fontPage2Bold("Arial", 24, QFont::Bold);//加粗
	painter.setFont(fontPage2Bold);

	int cellStartX = 8;//表格起点坐标X

	QString strTableCaption = A2T("%1巡检任务报告综述").arg(CRobData.m_strRobotName);//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

	// 绘制第一行合并的单元格
	QRect merged_cell_rectddd(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
	painter.drawRect(merged_cell_rectddd);  // 绘制单元格边框
	painter.drawText(merged_cell_rectddd, Qt::AlignCenter, CRobData.m_strRobotName);  // 绘制单元格内容

	// 绘制后面的单元格
	painter.setFont(fontPage2Normal);
	for (int nRow = 1; nRow < nRowCount; nRow++)
	{
		if (nRow == 1 || nRow == 2 || nRow == 8)  //  第二行、第三行和第九行  先合并后面3列
		{
			QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
			if (nRow == 1)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRobData.m_strTaskName);//任务名称
			}
			else if (nRow == 2)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRobData.m_strTaskTime);//巡检日期
			}
			else if (nRow == 8)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRobData.m_strComment);//备注为空
			}

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				if (nRow == 1)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检任务"));
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检日期"));
				}
				else if (nRow == 8)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
				}
			}
		}
		else // 其他普通单元格是4列的
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

				if (nRow == 3)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("开始时间"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, QDateTime::fromString(CRobData.m_strTaskStartTime, "yyyy-MM-dd hh:mm:ss").toString("hh:mm:ss"));
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("结束时间"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, QDateTime::fromString(CRobData.m_strTaskEndTime, "yyyy-MM-dd hh:mm:ss").toString("hh:mm:ss"));
					}
				}
				else if (nRow == 4)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("开始电量(%)"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strTaskStartElectricalValue);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("结束电量(%)"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strTaskEndElectricalValue);
					}
				}
				else if (nRow == 5)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("任务状态"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						if (CRobData.m_strTaskState == A2T("未完成"))//任务执行状态未完成的红色标出
						{
							painter.setPen(penNormalRed);
						}
						else
						{
							painter.setPen(penNormal);
						}
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strTaskState);
						painter.setPen(penNormal);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("合格率"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strPercentOfPass);
					}
				}
				else if (nRow == 6)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检点数量"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionPointCount);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项数量"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemCount);
					}

				}
				else if (nRow == 7)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项正常项数"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemNormalCount);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项异常项数"));
					}
					else if (nCol == 3)
					{
						if (CRobData.m_nInspectionItemAbnormalCount > 0)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色

							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemAbnormalCount);

							painter.setPen(penNormal);// 设置字体恢复
						}
						else
						{
							painter.setPen(penNormal);// 设置字体恢复

							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_strInspectionItemAbnormalCount);
						}

					}

				}

			}
		}
	}
	//后面加上异常项简要信息列表,有几项，增加几行
	int nVecAbnormalBriefCount = CRobData.m_vecAbnormalBriefList.size();
	if (nVecAbnormalBriefCount > 0)
	{
		int nRowNowHa = nRowCount + 1;//这里是从第9行开始
		//先绘制第一列合并单元格
		QRect merged_cell_TempHa(cellStartX, 60 + nRowNowHa * nCellHeight, nCellWidth, nCellHeight * nVecAbnormalBriefCount);//异常个数 倍的高度
		painter.drawRect(merged_cell_TempHa);  // 绘制单元格边框
		painter.setFont(fontPage2JiaCu);
		painter.drawText(merged_cell_TempHa, Qt::AlignCenter, A2T("异常项简要信息"));

		//再绘制后面的每行详细信息
		for (int nTempIndex = 0; nTempIndex < nVecAbnormalBriefCount; nTempIndex++)
		{
			nRowCount += 1;

			QRect merged_cell_rectHei(cellStartX + nCellWidth, 60 + (nRowNowHa + nTempIndex) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rectHei);  // 绘制单元格边框

			//文字的区域要加上向右偏移量
			QRect merged_cell_WordrectHei(cellStartX + nWordRightSkewing + nCellWidth, 60 + (nRowNowHa + nTempIndex) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.setFont(fontPage2Normal);
			painter.setPen(penNormalRed);//设置字体颜色为红色
			painter.drawText(merged_cell_WordrectHei, Qt::AlignLeft | Qt::AlignVCenter, CRobData.m_vecAbnormalBriefList[nTempIndex]);
			painter.setPen(penNormal);//设置字体颜色为恢复
		}
		


	}
	

	//=============连续报告综述追加在后面(这个不要了)============
#if 0
	{
		nRowCount += 1;

		// 绘制第一行合并的单元格
		QRect merged_cell_rectCotDetReview(cellStartX, 60 + nRowCount * nCellHeight, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectCotDetReview);  // 绘制单元格边框
		painter.setFont(fontPage2Bold);
		painter.drawText(merged_cell_rectCotDetReview, Qt::AlignCenter, A2T("连续检测"));  // 绘制单元格内容

		
		// 绘制后面的单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < 3; nRow++)
		{
			if (nRow == 1 || nRow == 2)  //  第二行、第三行 先合并后面3列
			{
				QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth * 3, nCellHeight);
				painter.drawRect(merged_cell_rect);  // 绘制单元格边框
				//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				if (nRow == 1)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRobData.m_VecCotIrInfo.size()));//红外报警数
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRobData.m_VecCotVoiceInfo.size()));//噪声报警数

				}


				// 绘制合并单元格左侧列的边框
				for (int nCol = 0; nCol < 1; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					if (nRow == 1)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("红外报警数"));
					}
					else if (nRow == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("噪声报警数"));
					}

				}
			}
			else
			{
				//暂无其他
			}
		}
	}
#endif

	//=============皮带纠偏综述追加在后面============
#if 1
	{
		nRowCount += 1;

		// 绘制第一行合并的单元格
		QRect merged_cell_rectBelt(cellStartX, 60 + nRowCount * nCellHeight, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectBelt);  // 绘制单元格边框
		painter.setFont(fontPage2Bold);
		painter.drawText(merged_cell_rectBelt, Qt::AlignCenter, A2T("皮带纠偏"));  // 绘制单元格内容

		// 绘制后面的单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < 5; nRow++)
		{
			if (nRow == 1 || nRow == 2 || nRow == 4)  //  第二行、第三行、第五行  先合并后面3列
			{
				QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth * 3, nCellHeight);
				painter.drawRect(merged_cell_rect);  // 绘制单元格边框
				//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				if (nRow == 1)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CRectifyData.m_strDetTime);//检测日期 2024-05-13
				}
				else if (nRow == 2)
				{
					if (CRectifyData.m_nAlmCount > 0)
					{
						painter.setPen(penNormalRed);// 设置字体颜色为红色

						painter.setFont(fontPage2JiaCu);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRectifyData.m_nAlmCount));//报警项数

						painter.setPen(penNormal);// 设置字体恢复
					}
					else
					{
						painter.setPen(penNormal);// 设置字体恢复

						painter.setFont(fontPage2Normal);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRectifyData.m_nAlmCount));//报警项数
					}


				}
				else if (nRow == 4)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CRectifyData.m_strComment);//备注为空
				}

				// 绘制合并单元格左侧列的边框
				for (int nCol = 0; nCol < 1; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					if (nRow == 1)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测日期"));
					}
					else if (nRow == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警项数"));
					}
					else if (nRow == 4)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
					}
				}
			}
			else
			{
				for (int nCol = 0; nCol < nColumnCount; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

					if (nRow == 3)//第四行
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测开始时间"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_strDetStartTime);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测结束时间"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_strDetEndTime);
						}
					}


				}
			}
		}
	}
#endif

	//=============皮带撕裂综述追加在后面============
#if 1
	{
		nRowCount += 6;

		// 绘制第一行合并的单元格
		QRect merged_cell_rectTear(cellStartX, 60 + nRowCount * nCellHeight, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectTear);  // 绘制单元格边框
		painter.setFont(fontPage2Bold);
		painter.drawText(merged_cell_rectTear, Qt::AlignCenter, A2T("皮带撕裂"));  // 绘制单元格内容

		

		// 绘制后面的单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < 5; nRow++)
		{
			if (nRow == 1 || nRow == 2 || nRow == 4)  //  第二行、第三行、第五行  先合并后面3列
			{
				QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth * 3, nCellHeight);
				painter.drawRect(merged_cell_rect);  // 绘制单元格边框
				//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				if (nRow == 1)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CTearData.m_strDetTime);//检测日期 2024-05-13
				}
				else if (nRow == 2)
				{
					if (CTearData.m_nAlmCount > 0)
					{
						painter.setPen(penNormalRed);// 设置字体颜色为红色

						painter.setFont(fontPage2JiaCu);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CTearData.m_nAlmCount));//报警项数

						painter.setPen(penNormal);// 设置字体恢复
					}
					else
					{
						painter.setPen(penNormal);// 设置字体恢复

						painter.setFont(fontPage2Normal);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CTearData.m_nAlmCount));//报警项数
					}

				}
				else if (nRow == 4)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CTearData.m_strComment);//备注为空
				}

				// 绘制合并单元格左侧列的边框
				for (int nCol = 0; nCol < 1; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					if (nRow == 1)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测日期"));
					}
					else if (nRow == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警项数"));
					}
					else if (nRow == 4)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
					}
				}
			}
			else
			{
				for (int nCol = 0; nCol < nColumnCount; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

					if (nRow == 3)//第四行
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测开始时间"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_strDetStartTime);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测结束时间"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_strDetEndTime);
						}
					}


				}
			}
		}
	}
#endif

	//=============其他AI检测综述 追加在后面============
#if 1
	{
		nRowCount += 6;

		// 绘制第一行合并的单元格
		QRect merged_cell_rectBeltTemp(cellStartX, 60 + nRowCount * nCellHeight, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectBeltTemp);  // 绘制单元格边框
		painter.setFont(fontPage2Bold);
		painter.drawText(merged_cell_rectBeltTemp, Qt::AlignCenter, A2T("其他AI检测"));  // 绘制单元格内容

		// 绘制后面的单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < 6; nRow++)
		{
			if (nRow == 1 || nRow == 2 || nRow == 4)  //  第二行、第三行、第五行  先合并后面3列
			{
				QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth * 3, nCellHeight);
				painter.drawRect(merged_cell_rect);  // 绘制单元格边框
				//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				if (nRow == 1)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strDetTime);//检测日期 2024-05-13
				}
				else if (nRow == 2)
				{
					if (CRectifyData.m_nAlmCount > 0)
					{
						painter.setPen(penNormalRed);// 设置字体颜色为红色

						painter.setFont(fontPage2JiaCu);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CExtraAiInfo.m_nAlmCount));//报警项数

						painter.setPen(penNormal);// 设置字体恢复
					}
					else
					{
						painter.setPen(penNormal);// 设置字体恢复

						painter.setFont(fontPage2Normal);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CExtraAiInfo.m_nAlmCount));//报警项数
					}


				}
				else if (nRow == 4)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strComment);//备注为空
				}

				// 绘制合并单元格左侧列的边框
				for (int nCol = 0; nCol < 1; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					if (nRow == 1)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测日期"));
					}
					else if (nRow == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警项数"));
					}
					else if (nRow == 4)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
					}
				}
			}
			else
			{
				for (int nCol = 0; nCol < nColumnCount; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

					if (nRow == 3)//第四行
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测开始时间"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strDetStartTime);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测结束时间"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strDetEndTime);
						}
					}


				}
			}
		}


		//有几种类型,往后追加几行显示各类型报警数量
		//获取map中有几种AI检测类型
		int nAiTypeCnt = CExtraAiInfo.m_mapExtraAiInfo.size();//数量
		;
		for (int nRow = 5; nRow < 5 + nAiTypeCnt; nRow++)
		{
			//先合并后面3列
			QRect merged_cell_rect_Temp(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect_Temp);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

			painter.setFont(fontPage2Normal);
			painter.drawText(merged_cell_rect_Temp, Qt::AlignCenter, QString::number(CExtraAiInfo.m_mapExtraAiInfo[nRow - 5].size()));//对应类型的报警数

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight + nRowCount * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

				QString sTypeDesc = "";
				switch (nRow - 5)
				{
				case enConvBeltForeObjDet:
					sTypeDesc = A2T("传送带异物识别");
					break;
				case enConvBeltMassFlowDet:
					sTypeDesc = A2T("传送带煤流量检测");
					break;
				default:
					sTypeDesc = A2T("未知类型检测");
					break;
					break;
				}
				QString sTypeNumDesc = A2T("%1数").arg(sTypeDesc);
				painter.setFont(fontPage2SmallJiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, sTypeNumDesc);
				painter.setFont(fontPage2JiaCu);
			}

		}

	}
#endif

	//nRowCount += 6;
	//nRowCount += CExtraAiInfo.m_mapExtraAiInfo.size();
	//这一页的表格周围大的一圈，需要加粗
	//painter.setPen(penJiaCu);
	//QRect merged_cell_rectDaQuan(cellStartX, 60, nCellWidth * 4, nCellHeight * nRowCount);
	//painter.drawRect(merged_cell_rectDaQuan);  // 绘制加粗的单元格边框


#if 0
//====================绘制第三页的表格(连续检测综述)===============
	painter.setPen(penNormal);
	nRowCount = 3;  // 表格行数
	nColumnCount = 4;  // 表格列数

	nCellWidth = 140;  // 单元格宽度
	nCellHeight = 30;  // 单元格高度

	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	printer.newPage(); // 添加新的一页

	painter.setFont(fontPage2Bold);
	strTableCaption = A2T("连续检测报告综述");//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

	// 绘制第一行合并的单元格
	QRect merged_cell_rectCotDetReview(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
	painter.drawRect(merged_cell_rectCotDetReview);  // 绘制单元格边框
	painter.drawText(merged_cell_rectCotDetReview, Qt::AlignCenter, A2T("连续检测"));  // 绘制单元格内容

	// 绘制后面的单元格
	painter.setFont(fontPage2Normal);
	for (int nRow = 1; nRow < nRowCount; nRow++)
	{
		if (nRow == 1 || nRow == 2)  //  第二行、第三行 先合并后面3列
		{
			QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
			if (nRow == 1)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRobData.m_VecCotIrInfo.size()));//红外报警数
			}
			else if (nRow == 2)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRobData.m_VecCotVoiceInfo.size()));//噪声报警数

			}


			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				if (nRow == 1)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("红外报警数"));
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("噪声报警数"));
				}

			}
		}
		else
		{
			//暂无其他
		}
	}
	//这一页的表格周围大的一圈，需要加粗
	painter.setPen(penJiaCu);
	QRect merged_cell_rectCotDetReviewCir(cellStartX, 60, nCellWidth * 4, nCellHeight * 4);
	painter.drawRect(merged_cell_rectCotDetReviewCir);  // 绘制加粗的单元格边框
#endif

#if 0
	//====================绘制第四页的表格(纠偏报警综述)===============
	painter.setPen(penNormal);
	nRowCount = 5;  // 表格行数
	nColumnCount = 4;  // 表格列数

	nCellWidth = 140;  // 单元格宽度
	nCellHeight = 30;  // 单元格高度

	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	printer.newPage(); // 添加新的一页

	painter.setFont(fontPage2Bold);
	strTableCaption = A2T("皮带纠偏报告综述");//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

	// 绘制第一行合并的单元格
	QRect merged_cell_rectBelt(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
	painter.drawRect(merged_cell_rectBelt);  // 绘制单元格边框
	painter.drawText(merged_cell_rectBelt, Qt::AlignCenter, A2T("皮带纠偏"));  // 绘制单元格内容

	// 绘制后面的单元格
	painter.setFont(fontPage2Normal);
	for (int nRow = 1; nRow < nRowCount; nRow++)
	{
		if (nRow == 1 || nRow == 2 || nRow == 4)  //  第二行、第三行、第五行  先合并后面3列
		{
			QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
			if (nRow == 1)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRectifyData.m_strDetTime);//检测日期 2024-05-13
			}
			else if (nRow == 2)
			{
				if (CRectifyData.m_nAlmCount > 0)
				{
					painter.setPen(penNormalRed);// 设置字体颜色为红色

					painter.setFont(fontPage2JiaCu);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRectifyData.m_nAlmCount));//报警项数

					painter.setPen(penNormal);// 设置字体恢复
				}
				else
				{
					painter.setPen(penNormal);// 设置字体恢复

					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CRectifyData.m_nAlmCount));//报警项数
				}

				
			}
			else if (nRow == 4)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CRectifyData.m_strComment);//备注为空
			}

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				if (nRow == 1)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测日期"));
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警项数"));
				}
				else if (nRow == 4)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
				}
			}
		}
		else
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

				if (nRow == 3)//第四行
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测开始时间"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_strDetStartTime);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测结束时间"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_strDetEndTime);
					}
				}
				

			}
		}
	}
	//这一页的表格周围大的一圈，需要加粗
	painter.setPen(penJiaCu);
	QRect merged_cell_rectDaQuan2(cellStartX, 60, nCellWidth * 4, nCellHeight * 6);
	painter.drawRect(merged_cell_rectDaQuan2);  // 绘制加粗的单元格边框

#endif

#if 0
	//====================绘制第五页的表格(撕裂报警综述)===============
	painter.setPen(penNormal);
	nRowCount = 5;  // 表格行数
	nColumnCount = 4;  // 表格列数

	nCellWidth = 140;  // 单元格宽度
	nCellHeight = 30;  // 单元格高度

	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	printer.newPage(); // 添加新的一页

	painter.setFont(fontPage2Bold);
	strTableCaption = A2T("皮带撕裂报告综述");//这个要加粗
	painter.drawText(cellStartX, 40, strTableCaption);//表格标题

	// 绘制第一行合并的单元格
	QRect merged_cell_rectTear(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
	painter.drawRect(merged_cell_rectTear);  // 绘制单元格边框
	painter.drawText(merged_cell_rectTear, Qt::AlignCenter, A2T("皮带撕裂"));  // 绘制单元格内容

	// 绘制后面的单元格
	painter.setFont(fontPage2Normal);
	for (int nRow = 1; nRow < nRowCount; nRow++)
	{
		if (nRow == 1 || nRow == 2 || nRow == 4)  //  第二行、第三行、第五行  先合并后面3列
		{
			QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
			if (nRow == 1)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CTearData.m_strDetTime);//检测日期 2024-05-13
			}
			else if (nRow == 2)
			{
				if (CTearData.m_nAlmCount > 0)
				{
					painter.setPen(penNormalRed);// 设置字体颜色为红色

					painter.setFont(fontPage2JiaCu);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CTearData.m_nAlmCount));//报警项数

					painter.setPen(penNormal);// 设置字体恢复
				}
				else
				{
					painter.setPen(penNormal);// 设置字体恢复

					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CTearData.m_nAlmCount));//报警项数
				}

			}
			else if (nRow == 4)
			{
				painter.setFont(fontPage2Normal);
				painter.drawText(merged_cell_rect, Qt::AlignCenter, CTearData.m_strComment);//备注为空
			}

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				if (nRow == 1)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测日期"));
				}
				else if (nRow == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警项数"));
				}
				else if (nRow == 4)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
				}
			}
		}
		else
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

				if (nRow == 3)//第四行
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测开始时间"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_strDetStartTime);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测结束时间"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_strDetEndTime);
					}
				}


			}
		}
	}
	//这一页的表格周围大的一圈，需要加粗
	painter.setPen(penJiaCu);
	QRect merged_cell_rectDaQuan3(cellStartX, 60, nCellWidth * 4, nCellHeight * 6);
	painter.drawRect(merged_cell_rectDaQuan3);  // 绘制加粗的单元格边框
#endif


#if 0
	{
		//====================绘制第六页的表格(其他AI检测综述)===============
		painter.setPen(penNormal);
		nRowCount = 5;  // 表格行数
		nColumnCount = 4;  // 表格列数

		nCellWidth = 140;  // 单元格宽度
		nCellHeight = 30;  // 单元格高度

		printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		printer.newPage(); // 添加新的一页

		painter.setFont(fontPage2Bold);
		strTableCaption = A2T("其他AI检测报告综述");//这个要加粗
		painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

		// 绘制第一行合并的单元格
		QRect merged_cell_rectBeltTemp(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectBeltTemp);  // 绘制单元格边框
		painter.drawText(merged_cell_rectBeltTemp, Qt::AlignCenter, A2T("其他AI检测"));  // 绘制单元格内容

		// 绘制后面的单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < nRowCount; nRow++)
		{
			if (nRow == 1 || nRow == 2 || nRow == 4)  //  第二行、第三行、第五行  先合并后面3列
			{
				QRect merged_cell_rect(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
				painter.drawRect(merged_cell_rect);  // 绘制单元格边框
				//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				if (nRow == 1)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strDetTime);//检测日期 2024-05-13
				}
				else if (nRow == 2)
				{
					if (CRectifyData.m_nAlmCount > 0)
					{
						painter.setPen(penNormalRed);// 设置字体颜色为红色

						painter.setFont(fontPage2JiaCu);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CExtraAiInfo.m_nAlmCount));//报警项数

						painter.setPen(penNormal);// 设置字体恢复
					}
					else
					{
						painter.setPen(penNormal);// 设置字体恢复

						painter.setFont(fontPage2Normal);
						painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(CExtraAiInfo.m_nAlmCount));//报警项数
					}


				}
				else if (nRow == 4)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(merged_cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strComment);//备注为空
				}

				// 绘制合并单元格左侧列的边框
				for (int nCol = 0; nCol < 1; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					if (nRow == 1)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测日期"));
					}
					else if (nRow == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警项数"));
					}
					else if (nRow == 4)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
					}
				}
			}
			else
			{
				for (int nCol = 0; nCol < nColumnCount; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_WordRect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

					if (nRow == 3)//第四行
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测开始时间"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strDetStartTime);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("检测结束时间"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CExtraAiInfo.m_strDetEndTime);
						}
					}


				}
			}
		}
		
		
		//有几种类型,往后追加几行显示各类型报警数量
		//获取map中有几种AI检测类型
		int nAiTypeCnt = CExtraAiInfo.m_mapExtraAiInfo.size();
		nRowCount = 5 + nAiTypeCnt;
		for (int nRow = 5; nRow < nRowCount; nRow++)
		{
			//先合并后面3列
			QRect merged_cell_rect_Temp(cellStartX + nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth * 3, nCellHeight);
			painter.drawRect(merged_cell_rect_Temp);  // 绘制单元格边框
			//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

			painter.setFont(fontPage2Normal);
			painter.drawText(merged_cell_rect_Temp, Qt::AlignCenter, QString::number(CExtraAiInfo.m_mapExtraAiInfo[nRow - 5].size()));//对应类型的报警数

			// 绘制合并单元格左侧列的边框
			for (int nCol = 0; nCol < 1; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				//文字的区域要加上向右偏移量
				//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

				QString sTypeDesc = "";
				switch (nRow - 5)
				{
				case enConvBeltForeObjDet:
					sTypeDesc = A2T("传送带异物识别");
					break;
				case enConvBeltMassFlowDet:
					sTypeDesc = A2T("传送带煤流量检测");
					break;
				default:
					sTypeDesc = A2T("未知类型检测");
					break;
					break;
				}
				QString sTypeNumDesc = A2T("%1数").arg(sTypeDesc);
				painter.setFont(fontPage2SmallJiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, sTypeNumDesc);
				painter.setFont(fontPage2JiaCu);
			}

		}
		
		//这一页的表格周围大的一圈，需要加粗
		painter.setPen(penJiaCu);
		QRect merged_cell_rectDaQuan2(cellStartX, 60, nCellWidth * 4, nCellHeight * (nRowCount+1));
		painter.drawRect(merged_cell_rectDaQuan2);  // 绘制加粗的单元格边框
	
	}


#endif

	//===================绘制下机器人后面页的巡检点表格(一个点一页，绘制一个表格)===============
#if 1
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	painter.setPen(penNormal);
	//遍历巡检点Vec容器
	for (int nPointIndex = 0; nPointIndex < CRobData.m_vecFormInspectionPointInfo.size(); nPointIndex++)
	{
		if (0 == CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo.size())
		{
			continue;//这个点没有已执行的巡检项,则跳过绘制这个点
		}

		

		//根据云台巡检项的个数判断A4纸是否够用
		int nYtItemsCount = 0;
		for (int j = 0; j < CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo.size(); j++)
		{
			if (CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo[j].emPdfOutItemType == EmPdfOutItemTypeDef::EN_InfraredThermometry
				|| CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo[j].emPdfOutItemType == EmPdfOutItemTypeDef::EN_PhotoGraph)
			{
				nYtItemsCount++;
			}
		}
		if (nYtItemsCount > 2)//云台巡检项的个数大于2个 A4纸大小就不够了
		{
			int nPageHeight = 297 + (nYtItemsCount - 2) * 11 * 6;//这个大小测试的适配成功
			//QSizeF pageSizeTemp(210, 1000);
			QSizeF pageSizeTemp(210, nPageHeight);
			printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
		}
		else
		{
			printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		}

		printer.newPage();//添加新的一页

		painter.setPen(penNormal);

		int nCellStartXPo = 8;//表格起点坐标X

		painter.setFont(fontPage2Bold);
		
		QString strTableCaption = "";
		if (CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_sRollerDesc.size() < 1)
		{
			//strTableCaption = A2T("巡检点%1").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
			strTableCaption = A2T("%1").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
		}
		else
		{
			//strTableCaption = A2T("托辊%1(巡检点%2)").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_sRollerDesc).arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
			strTableCaption = A2T("%1").arg(CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
		}
		
		painter.drawText(nCellStartXPo, 20, strTableCaption); // 表格标题 (巡检点 + 托辊描述) 100

		nRowCount = 4;  // 表格行数
		nColumnCount = 4;  // 表格列数

		int nCellWidthPo = 140;  // 单元格宽度
		int nCellHeightPo = 30;  // 单元格高度


		// 绘制第一行合并的单元格
		QRect merged_cell_rect_Po(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 2);//150
		painter.drawRect(merged_cell_rect_Po);  // 绘制单元格边框
		painter.drawText(merged_cell_rect_Po, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strRobotName);  // 绘制单元格内容 (机器人名称)

		// 绘制后面的第2、3、4行单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < nRowCount; nRow++)
		{
			if (nRow == 1 || nRow == 2 || nRow == 3)
			{
				for (int nCol = 0; nCol < nColumnCount; nCol++)
				{
					QRect cell_rect(cellStartX + nCol * nCellWidthPo, 40 + (nRow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo);
					painter.drawRect(cell_rect);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					if (nRow == 1)
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检点"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectionPointName);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strLocation);
						}
					}
					else if (nRow == 2)
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检日期"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectDate);
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检时间"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2Normal);
							painter.drawText(cell_rect, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strInspectTime);
						}
					}
					else if (nRow == 3)
					{
						if (nCol == 0)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("巡检项"));
						}
						else if (nCol == 1)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("测量值"));
						}
						else if (nCol == 2)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("状态"));
						}
						else if (nCol == 3)
						{
							painter.setFont(fontPage2JiaCu);
							painter.drawText(cell_rect, Qt::AlignCenter, A2T("阈值"));
						}
					}
				}
			}

		}



		//遍历巡检项，往表格下面接着开始绘制
		int nRowTempNow = 4;//从4行开始
		nRowTempNow += 1;//因为第一行用了两行的高度，所有要+1
		QVector<CPdfOutInspecItemInfoAll> vecInspecItemsInfoTemp = CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_vecInspecItemsInfo;
		int nItemsCount = vecInspecItemsInfoTemp.size();//巡检项个数
		for (int i = 0; i < nItemsCount; i++)
		{
			switch (vecInspecItemsInfoTemp[i].emPdfOutItemType)
			{
			case EmPdfOutItemTypeDef::EN_None:
			{
				//无 不用绘制
			}
			break;
			case EmPdfOutItemTypeDef::EN_PM25:
			{
				//============PM2.5
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("PM2.5"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);


						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{


						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色
						}


						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_PM10:
			{
				//============PM10
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("PM10"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);


						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{


						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色
						}


						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Co:
			{
				//============一氧化碳
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("一氧化碳"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);


						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{


						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);// 设置字体颜色为红色
						}


						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_CombustibleGas:
			{
				//============可燃气体
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("可燃气体"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Temperature:
			{
				//============温度
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("温度"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Humidity:
			{
				//============湿度
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("湿度"));
					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{

						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_Voice:
			{
				//============声音
				//绘制一行
				for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					painter.setFont(fontPage2Normal);

					if (nCol == 0)
					{
						painter.setFont(fontPage2SmallJiaCu);
						QString sItemName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
						painter.drawText(cell_rectTemp, Qt::TextWordWrap | Qt::AlignCenter, sItemName);
						//painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("声音"));

					}
					else if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{

						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}



				nRowTempNow++;
			}
			break;
			case EmPdfOutItemTypeDef::EN_InfraredThermometry:
			{
				//============红外测温
				//先绘制第一列合并上下两个单元格
				QRect merged_cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo * 6);//6倍的高度,因为要放图片 150
				painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
				painter.setFont(fontPage2JiaCu);
				QString sIrName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
				painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sIrName);
				//painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("红外测温"));

				//绘制右侧的测量值、状态、备注这3个信息单元格
				painter.setFont(fontPage2Normal);
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("最高") + QString::number(vecInspecItemsInfoTemp[i].m_doMeasurementVal) + vecInspecItemsInfoTemp[i].m_strUnit);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}
				}

				//绘制图片栏
				//QPixmap *pPixmapA = new QPixmap(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				QPixmap PixmapA(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), PixmapA);

				//绘制图片备注栏
				QRect merged_cell_TempCC(cellStartX + 3 * nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo * 5);
				painter.drawRect(merged_cell_TempCC);  // 绘制单元格边框
				painter.setFont(fontPage2SmallNormal);
				painter.drawText(merged_cell_TempCC, Qt::TextWordWrap | Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strPictureRemark);
				painter.setFont(fontPage2Normal);
				
				nRowTempNow += 6;
			}
			break;
			case EmPdfOutItemTypeDef::EN_PhotoGraph:
			{
				//============图像相机
				//先绘制第一列合并上下两个单元格
				QRect merged_cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo * 6);//6倍的高度,因为要放图片 150
				painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
				painter.setFont(fontPage2JiaCu);
				QString sVisName = A2T("%1").arg(vecInspecItemsInfoTemp[i].m_sItemName);
				painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sVisName);
				//painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("图像相机"));

				//绘制右侧的测量值、状态、备注这3个信息单元格
				painter.setFont(fontPage2Normal);
				for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
				{
					QRect cell_rectTemp(cellStartX + nCol * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);//150
					painter.drawRect(cell_rectTemp);// 绘制单元格边框

					if (nCol == 1)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("/"));

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 2)
					{
						//异常需要画红色字体
						if (false == vecInspecItemsInfoTemp[i].m_bStateOk)
						{
							painter.setPen(penNormalRed);//设置字体颜色为红色
						}

						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strState);

						painter.setPen(penNormal);// 设置字体恢复
					}
					else if (nCol == 3)
					{
						painter.drawText(cell_rectTemp, Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strRemark);
					}

				}

				//绘制图片栏(这里用http图片)
				//QPixmap PixmapHttp(vecInspecItemsInfoTemp[i].m_strPictureAddress);
				//painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), PixmapHttp);
				{
					QString sHttpPicUrl = vecInspecItemsInfoTemp[i].m_sHttpPicAddr;
					CImageDownloader downPic(sHttpPicUrl);
					QPixmap pixmapNow;
					if (sHttpPicUrl.size() > 0)
					{
						downPic.getNewDlPixmap(pixmapNow);
					}
					painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo * 2, nCellHeightPo * 5), pixmapNow);
				}


				//绘制图片备注栏
				QRect merged_cell_Temp_Http(cellStartX + 3 * nCellWidthPo, 40 + (nRowTempNow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo * 5);
				painter.drawRect(merged_cell_Temp_Http);  // 绘制单元格边框
				painter.drawText(merged_cell_Temp_Http, Qt::TextWordWrap | Qt::AlignCenter, vecInspecItemsInfoTemp[i].m_strPictureRemark);//这个备注长，需要自动换行

				nRowTempNow += 6;

			}
			break;
			default:
				break;
			}
		}

		//往表格下面接着 绘制一行备注
		{
			QRect cell_Temp1(cellStartX, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo, nCellHeightPo);
			painter.drawRect(cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			painter.drawText(cell_Temp1, Qt::AlignCenter, A2T("备注"));


			QRect cell_Temp2(cellStartX + 1 * nCellWidthPo, 40 + nRowTempNow * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo);
			painter.drawRect(cell_Temp2);  // 绘制单元格边框
			painter.setFont(fontPage2Normal);
			painter.drawText(cell_Temp2, Qt::AlignCenter, CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_strRemark);

			nRowTempNow++;
		}


		//绘制两个表格周围的加粗框
		painter.setPen(penJiaCu);
		//1
		QRect merged_cell_rectDaQuanA(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 4);
		painter.drawRect(merged_cell_rectDaQuanA);  // 绘制加粗的单元格边框
		//2
		int ntDaQuanBRows = nRowTempNow - 4;
		QRect merged_cell_rectDaQuanB(nCellStartXPo, 40 + 4 * nCellHeightPo, nCellWidthPo * 4, nCellHeightPo * ntDaQuanBRows);
		painter.drawRect(merged_cell_rectDaQuanB);  // 绘制加粗的单元格边框


		#if 0
		//做穿插连续检测
		//然后查找该点和下一个点之间,有多少连续检测数据
		int nStartRoller = CRobData.m_vecFormInspectionPointInfo[nPointIndex].m_nRollerCode;
		int nEndRoller = 0;
		if (CRobData.m_vecFormInspectionPointInfo.size() > (nPointIndex + 1))
		{
			nEndRoller = CRobData.m_vecFormInspectionPointInfo[nPointIndex + 1].m_nRollerCode;
		}
		else
		{
			//是最后一个点
			nEndRoller += 100000;
		}
		QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfo;//连续红外结果数组
		QMap<int, QVector<CPdfCotVoiceInfo>> mapCotVoiceInfo;//连续声音结果数组 <托辊号, 结果>
		getBetwTwoRollerCotData(nStartRoller, nEndRoller, mapCotIrInfo, mapCotVoiceInfo, CRobData.m_VecCotIrInfo, CRobData.m_VecCotVoiceInfo);
		//绘制新一页连续红外
		if (mapCotIrInfo.size() > 0)
		{
			drawNewPageCotIr(mapCotIrInfo, painter, printer);
		}
		//绘制一页连续噪声(先删掉)
		#endif
	}
#endif

	//=====================连续噪声监测报警详情列表(暂时不显示)====================//
#if 0
	if (CRobData.m_VecCotVoiceInfo.size() > 0)
	{

		//先计算A4纸是否满足 不然就要自定义高度
		if (CRobData.m_VecCotVoiceInfo.size() > 21)//异常信息列表大于21行,A4纸大小就不够了
		{
			//int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
			int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
			//QSizeF pageSizeTemp(210, 1000);
			QSizeF pageSizeTemp(210, nPageHeightVal);
			printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
		}
		else
		{
			printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		}

		painter.setPen(penNormal);
		nRowCount = 3;  // 表格行数
		nColumnCount = 4;  // 表格列数

		nCellWidth = 140;  // 单元格宽度
		nCellHeight = 30;  // 单元格高度


		//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		printer.newPage(); // 添加新的一页

		painter.setFont(fontPage2Bold);
		strTableCaption = A2T("连续噪声检测详细描述");//这个要加粗
		painter.drawText(cellStartX, 40, strTableCaption); // 表格标题

		// 绘制第一行合并的单元格
		QRect merged_cell_rectVoice(cellStartX, 60, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectVoice);  // 绘制单元格边框
		painter.drawText(merged_cell_rectVoice, Qt::AlignCenter, A2T("噪声检测"));  // 绘制单元格内容

		// 绘制第二行标题栏
		int nRowTemporary = 2;//从2行开始
		nRowTemporary += 1;//因为第一行用了两行的高度，所有要+1
		for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
		{
			QRect cell_rect(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight, nCellWidth, nCellHeight);
			painter.drawRect(cell_rect);  // 绘制单元格边框
			//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容


			if (nCol == 0)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));//米(托辊号)
			}
			else if (nCol == 1)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("噪声值"));
			}
			else if (nCol == 2)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警描述"));
			}
			else if (nCol == 3)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("备注"));
			}


		}
		nRowTemporary++;

		//遍历噪声报警列表，往后继续绘制
		for (int nAlmIndex = 0; nAlmIndex < CRobData.m_VecCotVoiceInfo.size(); nAlmIndex++)
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)//还是4列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				painter.setFont(fontPage2Normal);

				if (nCol == 0)//位置
				{
					QString sLoca = A2T("%1m(托辊:%2)").arg(QString::number(CRobData.m_VecCotVoiceInfo[nAlmIndex].m_dLocation, 'f', 1)).arg(CRobData.m_VecCotVoiceInfo[nAlmIndex].m_sRollerDesc);
					painter.drawText(cell_rectTemp, Qt::AlignCenter, sLoca);
				}
				else if (nCol == 1)//噪声值
				{
					painter.setPen(penNormalRed);//设置字体颜色为红色
					painter.drawText(cell_rectTemp, Qt::AlignCenter, QString::number(CRobData.m_VecCotVoiceInfo[nAlmIndex].m_dValue, 'f', 1));
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 2)//报警描述
				{
					painter.setPen(penNormalRed);//设置字体颜色为红色
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotVoiceInfo[nAlmIndex].m_strAlmDesc);
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 3)//备注
				{
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotVoiceInfo[nAlmIndex].m_sRemark);
				}
			}



			nRowTemporary++;
		}
	}
#endif

	//=====================连续红外监测报警详情列表====================//
	{
		//QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfo;//连续红外结果数组
		//getCotMapIrData(mapCotIrInfo, CRobData.m_VecCotIrInfo);
		//drawNewPageCotIr(mapCotIrInfo, painter, printer);
	}

	//=====================连续检测详情列表(连续红外和连续噪声在一起显示)====================//
	QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfo;//连续红外结果数组
	getCotMapIrData(mapCotIrInfo, CRobData.m_VecCotIrInfo);
	QMap<int, QVector<CPdfCotVoiceInfo>> mapCotVoiceInfo;//连续声音结果数组
	getCotMapVoiceData(mapCotVoiceInfo, CRobData.m_VecCotVoiceInfo);
	QMap<int, QVector<CPdfCotImageInfo>> mapCotImageInfo;//连续图像结果数组
	getCotMapImageData(mapCotImageInfo, CRobData.m_VecCotImageInfo);
	//一来一回会有两个相同的托辊号 QVector中有两个数据 红外、声音、图像都是两个
	calculateCotRetBelongTier(mapCotIrInfo, mapCotVoiceInfo, mapCotImageInfo);//计算连续检测结果归属层级
	//绘制新的一个连续红外+连续声音在一起
	drawNewPageCotAll(mapCotIrInfo, mapCotVoiceInfo, mapCotImageInfo, painter, printer);

#if 0
	if (CRobData.m_VecCotIrInfo.size() > 0)
	{

		//先计算A4纸是否满足 不然就要自定义高度
		if (CRobData.m_VecCotIrInfo.size() > 3)//异常信息列表大于3行,A4纸大小就不够了
		{
			//int nPageHeightVal = 297 + (CRobData.m_VecCotVoiceInfo.size() - 21 + 1) * 11;//这个大小测试的适配成功
			int nPageHeightVal = 297 + (CRobData.m_VecCotIrInfo.size() * 6 - 21 + 1) * 11;//这个大小测试的适配成功
			//QSizeF pageSizeTemp(210, 1000);
			QSizeF pageSizeTemp(210, nPageHeightVal);
			printer.setPageSize(QPageSize(pageSizeTemp, QPageSize::Millimeter));
		}
		else
		{
			printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		}


		painter.setPen(penNormal);
		nRowCount = 3;  // 表格行数
		nColumnCount = 4;  // 表格列数

		nCellWidth = 140;  // 单元格宽度
		nCellHeight = 30;  // 单元格高度


		//printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
		printer.newPage(); // 添加新的一页

#if 0
		//这个暂时不要了
		painter.setFont(fontPage2Bold);
		strTableCaption = A2T("连续红外检测详细描述");//这个要加粗
		painter.drawText(cellStartX, 40, strTableCaption); // 表格标题
#endif

		// 绘制第一行合并的单元格
		QRect merged_cell_rectVoice(cellStartX, 60 - 40, nCellWidth * 4, nCellHeight * 2);//高度占2行
		painter.drawRect(merged_cell_rectVoice);  // 绘制单元格边框
		painter.drawText(merged_cell_rectVoice, Qt::AlignCenter, A2T("连续托辊检测"));  // 绘制单元格内容

		// 绘制第二行标题栏
		int nRowTemporary = 2;//从2行开始
		nRowTemporary += 1;//因为第一行用了两行的高度，所有要+1
		for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
		{
			QRect cell_rect(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);
			painter.drawRect(cell_rect);  // 绘制单元格边框
			//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容


			if (nCol == 0)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("位置"));//米(托辊号)
			}
			else if (nCol == 1)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("测量值"));
			}
			else if (nCol == 2)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("状态"));
			}
			else if (nCol == 3)
			{
				painter.setFont(fontPage2JiaCu);
				painter.drawText(cell_rect, Qt::AlignCenter, A2T("阈值"));
			}


		}
		nRowTemporary++;

		//遍历红外报警列表，往后继续绘制
		for (int nAlmIndex = 0; nAlmIndex < CRobData.m_VecCotIrInfo.size(); nAlmIndex++)
		{
			//============红外测温
			//先绘制第一列合并上下两个单元格 位置
			QRect merged_cell_Temp1(cellStartX, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight * 6);//6倍的高度,因为要放图片 150
			painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			QString sLoca = A2T("托辊:%1(%2m)").arg(CRobData.m_VecCotIrInfo[nAlmIndex].m_sRollerDesc).arg(QString::number(CRobData.m_VecCotIrInfo[nAlmIndex].m_dLocation, 'f', 1));
			painter.drawText(merged_cell_Temp1, Qt::TextWordWrap | Qt::AlignCenter, sLoca);

			//绘制右侧的测量值、状态、备注这3个信息单元格
			painter.setFont(fontPage2Normal);
			for (int nCol = 1; nCol < nColumnCount; nCol++)//后面3列
			{
				QRect cell_rectTemp(cellStartX + nCol * nCellWidth, 40 + nRowTemporary * nCellHeight - 40, nCellWidth, nCellHeight);//150
				painter.drawRect(cell_rectTemp);// 绘制单元格边框

				if (nCol == 1)//测量值
				{
					if (0 == CRobData.m_VecCotIrInfo[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}

					
					painter.drawText(cell_rectTemp, Qt::AlignCenter, A2T("最高") + QString::number(CRobData.m_VecCotIrInfo[nAlmIndex].m_doMeasurementVal) + A2T("℃"));
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 2)//状态
				{
					if (0 == CRobData.m_VecCotIrInfo[nAlmIndex].m_nAlmState)
					{
						painter.setPen(penNormal);
					}
					else
					{
						painter.setPen(penNormalRed);//设置字体颜色为红色
					}
					
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotIrInfo[nAlmIndex].m_strAlmDesc);
					painter.setPen(penNormal);//设置字体颜色恢复
				}
				else if (nCol == 3)//备注
				{
					painter.drawText(cell_rectTemp, Qt::AlignCenter, CRobData.m_VecCotIrInfo[nAlmIndex].m_sRemark);
				}
			}

			//绘制图片栏
			QPixmap pixmapPic(CRobData.m_VecCotIrInfo[nAlmIndex].m_sPictureAddress);
			painter.drawPixmap(QRect(cellStartX + nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth * 2, nCellHeight * 5), pixmapPic);

			//绘制图片备注栏
			QRect mergedCellTemp(cellStartX + 3 * nCellWidth, 40 + (nRowTemporary + 1) * nCellHeight - 40, nCellWidth, nCellHeight * 5);
			painter.drawRect(mergedCellTemp);  // 绘制单元格边框
			
			painter.setFont(fontPage2SmallNormal);
			painter.drawText(mergedCellTemp, Qt::AlignCenter, CRobData.m_VecCotIrInfo[nAlmIndex].m_sPictureRemark);
			painter.setFont(fontPage2Normal);
			nRowTemporary += 6;
		}
	}
#endif

	//===================绘制下后面页的纠偏报警表格(一个报警一页，绘制一个表格)===============
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	painter.setPen(penNormal);
	//遍历Vec容器
	for (int nIndex = 0; nIndex < CRectifyData.m_vecFormRecAlmInfo.size(); nIndex++)
	{
		printer.newPage();//添加新的一页

		painter.setPen(penNormal);

		int nCellStartXPo = 8;//表格起点坐标X

		painter.setFont(fontPage2Bold);
		QString strTableCaption = A2T("纠偏点%1报警%2").arg(CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sRecPointName).arg(nIndex + 1);
		painter.drawText(nCellStartXPo, 20, strTableCaption); // 表格标题 (纠偏点 + 纠偏点名称) 100

		nRowCount = 3;  // 表格行数
		nColumnCount = 4;  // 表格列数

		int nCellWidthPo = 140;  // 单元格宽度
		int nCellHeightPo = 30;  // 单元格高度


		// 绘制第一行合并的单元格
		QRect merged_cell_rect_Po(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 2);//150
		painter.drawRect(merged_cell_rect_Po);  // 绘制单元格边框
		painter.drawText(merged_cell_rect_Po, Qt::AlignCenter, CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sBeltName);  // 绘制单元格内容 (皮带名称)

		// 绘制后面的第2、3行单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < nRowCount; nRow++)
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidthPo, 40 + (nRow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				if (nRow == 1)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("纠偏点"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2SmallNormal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sRecPointName);
						painter.setFont(fontPage2Normal);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警序号"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, QString::number(nIndex + 1));
					}
				}
				else if (nRow == 2)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("跑偏开始时间"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sRecStartTime);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("跑偏结束时间"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sRecEndTime);
					}
				}
				
			}
		}
		//绘制图片
		{
			//============纠偏图片
			//先绘制第一列合并上下两个单元格
			QRect merged_cell_Temp1(cellStartX, 40 + nRowCount * nCellHeightPo, nCellWidthPo, nCellHeightPo * 9);//6倍的高度,因为要放图片 150
			painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("纠偏图片"));

			
			//绘制图片栏
			//QPixmap PixmapPic(CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sPictureUrl);//需要改成http图片
			//http图片需要转成QPixmap
			//测试下载图片
			QString sHttpPicUrl = CRectifyData.m_vecFormRecAlmInfo[nIndex].m_sPictureUrl;
			CImageDownloader downPic(sHttpPicUrl);
			QPixmap pixmapNow;
			if (sHttpPicUrl.size() > 0)
			{
				downPic.getNewDlPixmap(pixmapNow);
			}
			painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo * 8), pixmapNow);

		}
		//绘制周围一圈加粗
		{
			painter.setPen(penJiaCu);
			QRect merged_cell_rect_Cir(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 12);
			painter.drawRect(merged_cell_rect_Cir);  // 绘制加粗的单元格边框
		}
	}

	//===================绘制下后面页的撕裂报警表格(一个报警一页，绘制一个表格)===============
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	painter.setPen(penNormal);
	//遍历Vec容器
	for (int nIndex = 0; nIndex < CTearData.m_vecFormTearAlmInfo.size(); nIndex++)
	{
		printer.newPage();//添加新的一页

		painter.setPen(penNormal);

		int nCellStartXPo = 8;//表格起点坐标X

		painter.setFont(fontPage2Bold);
		QString strTableCaption = A2T("撕裂点%1报警%2").arg(CTearData.m_vecFormTearAlmInfo[nIndex].m_sTearPointName).arg(nIndex + 1);
		painter.drawText(nCellStartXPo, 20, strTableCaption); // 表格标题 (撕裂点 + 撕裂点名称) 100

		nRowCount = 3;  // 表格行数
		nColumnCount = 4;  // 表格列数

		int nCellWidthPo = 140;  // 单元格宽度
		int nCellHeightPo = 30;  // 单元格高度


		// 绘制第一行合并的单元格
		QRect merged_cell_rect_Po(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 2);//150
		painter.drawRect(merged_cell_rect_Po);  // 绘制单元格边框
		painter.drawText(merged_cell_rect_Po, Qt::AlignCenter, CTearData.m_vecFormTearAlmInfo[nIndex].m_sBeltName);  // 绘制单元格内容 (皮带名称)

		// 绘制后面的第2、3行单元格
		painter.setFont(fontPage2Normal);
		for (int nRow = 1; nRow < nRowCount; nRow++)
		{
			for (int nCol = 0; nCol < nColumnCount; nCol++)
			{
				QRect cell_rect(cellStartX + nCol * nCellWidthPo, 40 + (nRow + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo);
				painter.drawRect(cell_rect);  // 绘制单元格边框
				//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

				if (nRow == 1)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("撕裂点"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2SmallNormal);
						painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_vecFormTearAlmInfo[nIndex].m_sTearPointName);
						painter.setFont(fontPage2Normal);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警序号"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, QString::number(nIndex + 1));
					}
				}
				else if (nRow == 2)
				{
					if (nCol == 0)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("撕裂开始时间"));
					}
					else if (nCol == 1)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_vecFormTearAlmInfo[nIndex].m_sTearStartTime);
					}
					else if (nCol == 2)
					{
						painter.setFont(fontPage2JiaCu);
						painter.drawText(cell_rect, Qt::AlignCenter, A2T("撕裂结束时间"));
					}
					else if (nCol == 3)
					{
						painter.setFont(fontPage2Normal);
						painter.drawText(cell_rect, Qt::AlignCenter, CTearData.m_vecFormTearAlmInfo[nIndex].m_sTearEndTime);
					}
				}

			}
		}
		//绘制图片
		{
			//============撕裂图片
				//先绘制第一列合并上下两个单元格
			QRect merged_cell_Temp1(cellStartX, 40 + nRowCount * nCellHeightPo, nCellWidthPo, nCellHeightPo * 9);//6倍的高度,因为要放图片 150
			painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
			painter.setFont(fontPage2JiaCu);
			painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("撕裂图片"));


			//绘制图片栏
			//QPixmap PixmapPic(CTearData.m_vecFormTearAlmInfo[nIndex].m_sPictureUrl);
			//http图片需要转成QPixmap
			//测试下载图片
			QString sHttpPicUrl = CTearData.m_vecFormTearAlmInfo[nIndex].m_sPictureUrl;
			CImageDownloader downPic(sHttpPicUrl);
			QPixmap pixmapNow;
			if (sHttpPicUrl.size() > 0)
			{
				downPic.getNewDlPixmap(pixmapNow);
			}
			painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo * 8), pixmapNow);

		}
		//绘制周围一圈加粗
		{
			painter.setPen(penJiaCu);
			QRect merged_cell_rect_Cir(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 12);
			painter.drawRect(merged_cell_rect_Cir);  // 绘制加粗的单元格边框
		}
	}


	//===================绘制下后面页的其他Ai检测报警表格(一个报警一页，绘制一个表格)===============
	printer.setPageSize(QPageSize(QPageSize::A4));// 设置页面大小为A4
	painter.setPen(penNormal);
	int nIndexAi = 0;
	for (QMap<int, QVector<CPdfExtraAiAlmInfo>>::iterator i = CExtraAiInfo.m_mapExtraAiInfo.begin(); i != CExtraAiInfo.m_mapExtraAiInfo.end(); i++)
	{
		QString sDetTypeName = "";
		if (i.key() == enConvBeltForeObjDet)//传送带异物识别
		{
			sDetTypeName = A2T("传送带异物识别");
		}
		else if (i.key() == enConvBeltMassFlowDet)//传送带煤流量检测
		{
			sDetTypeName = A2T("传送带煤流量检测");
		}
		else
		{
			continue;
		}

		QVector<CPdfExtraAiAlmInfo> vecTe = i.value();
		//遍历这个类型的所有报警
		for (int j = 0; j < vecTe.size(); j++)
		{
			nIndexAi++;

			printer.newPage();//添加新的一页

			painter.setPen(penNormal);

			int nCellStartXPo = 8;//表格起点坐标X

			painter.setFont(fontPage2Bold);
			QString strTableCaption = A2T("其他AI检测报警%2").arg(nIndexAi);
			painter.drawText(nCellStartXPo, 20, strTableCaption); // 表格标题 

			nRowCount = 3;  // 表格行数
			nColumnCount = 4;  // 表格列数

			int nCellWidthPo = 140;  // 单元格宽度
			int nCellHeightPo = 30;  // 单元格高度


			// 绘制第一行合并的单元格
			QRect merged_cell_rect_POAI(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 2);//150
			painter.drawRect(merged_cell_rect_POAI);  // 绘制单元格边框
			painter.drawText(merged_cell_rect_POAI, Qt::AlignCenter, sDetTypeName);  // 绘制单元格内容 (标题)

			//绘制第二行
			nRowCount = 1;
			for (int nCol = 0; nCol < nColumnCount; nCol++)//4列
			{
				QRect cell_rect(nCellStartXPo + nCol * nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo);
				painter.drawRect(cell_rect);  // 绘制单元格边框

				if (nCol == 0)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警时间"));
				}
				else if (nCol == 1)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(cell_rect, Qt::AlignCenter, vecTe[j].m_sAlmTime);
				}
				else if (nCol == 2)
				{
					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect, Qt::AlignCenter, A2T("报警序号"));
				}
				else if (nCol == 3)
				{
					painter.setFont(fontPage2Normal);
					painter.drawText(cell_rect, Qt::AlignCenter, QString::number(nIndexAi));
				}
			}

			//绘制第三行
			nRowCount += 1;
			{
				//只写报警描述
				QRect cell_rect2(nCellStartXPo + nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo);
				painter.drawRect(cell_rect2);  // 绘制单元格边框
				//painter.drawText(merged_cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容
				painter.setFont(fontPage2Normal);
				painter.drawText(cell_rect2, Qt::AlignCenter, vecTe[j].m_sAlmDesc);//报警描述

				// 绘制合并单元格左侧列的边框
				for (int nCol = 0; nCol < 1; nCol++)
				{
					QRect cell_rect3(nCellStartXPo + nCol * nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo, nCellHeightPo);
					painter.drawRect(cell_rect3);  // 绘制单元格边框
					//painter.drawText(cell_rect, Qt::AlignCenter, QString::number(QRandomGenerator::global()->bounded(100)));  // 填充随机内容

					//文字的区域要加上向右偏移量
					//QRect cell_Wordrect(cellStartX + nWordRightSkewing + nCol * nCellWidth, 60 + (nRow + 1) * nCellHeight, nCellWidth, nCellHeight);

					painter.setFont(fontPage2JiaCu);
					painter.drawText(cell_rect3, Qt::AlignCenter, A2T("报警描述"));

				}
			}

			
			//绘制图片
			nRowCount += 1;
			{
				//============图片
			    //先绘制第一列合并上下两个单元格
				QRect merged_cell_Temp1(nCellStartXPo, 40 + nRowCount * nCellHeightPo, nCellWidthPo, nCellHeightPo * 9);//6倍的高度,因为要放图片 150
				painter.drawRect(merged_cell_Temp1);  // 绘制单元格边框
				painter.setFont(fontPage2JiaCu);
				painter.drawText(merged_cell_Temp1, Qt::AlignCenter, A2T("报警图片"));

				//绘制图片栏
				//QPixmap PixmapPic(vecTe[j].m_sHttpPictureUrl);//(本地图片不能使用)
				//painter.drawPixmap(QRect(cellStartX + nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo * 8), PixmapPic);

				//http图片需要转成QPixmap
				//测试下载图片
				QString sHttpPicUrl = vecTe[j].m_sHttpPictureUrl;
				CImageDownloader downPic(sHttpPicUrl);
				QPixmap pixmapNow;
				if (sHttpPicUrl.size() > 0)
				{
					double dWid = vecTe[j].m_dImageWid < 1 ? 1920 : vecTe[j].m_dImageWid;
					double dHig = vecTe[j].m_dImageHig < 1 ? 1080 : vecTe[j].m_dImageHig;

					downPic.getNewDlPixmap(pixmapNow, vecTe[j].vecPolygonArea, dWid, dHig);
				}
				painter.drawPixmap(QRect(nCellStartXPo + nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo * 8), pixmapNow);

				

				//painter.drawPixmap(QRect(nCellStartXPo + nCellWidthPo, 40 + (nRowCount + 1) * nCellHeightPo, nCellWidthPo * 3, nCellHeightPo * 8), PixmapPic);

			}
			//绘制周围一圈加粗
			{
				painter.setPen(penJiaCu);
				QRect merged_cell_rect_Cir(nCellStartXPo, 40, nCellWidthPo * 4, nCellHeightPo * 12);
				painter.drawRect(merged_cell_rect_Cir);  // 绘制加粗的单元格边框
			}

		}


		

	}
	
	// 结束绘制
	if (!painter.end())
	{
		sErrMsg = A2T("QPainter end 失败");
		return false;
	}

	return true;
}

//导出报表(机器人巡检任务)
bool CPdfReport::exportRobReport(CTaskExecInfo* pTaskExecInfo, CDevDataBase* pDevData, QString strComment, QString &sErrMsg)
{
	if (pTaskExecInfo == nullptr || pDevData == nullptr)
	{
		sErrMsg = A2T("机器人数据指针为空");
		return false;
	}
	QDateTime dtTimeCurrent = QDateTime::currentDateTime();//当前系统时间
	QString strTemp = "";

	//编辑pdf输出信息
	CPdfReportInfo reportInfo;
	reportInfo.m_strTaskActionId = pTaskExecInfo->m_sTaskExecGuid;//子任务Id(用于更新数据库中的pdf存储地址)

	//==================组装连续检测信息=====================
	int nCotNormalNUmber = 0;//连续检测正常项数
	int nCotAlmNumber = 0;//连续检测异常项数
	//遍历所有巡检项，找到连续检测的 所有起点和中间点的 找到里面的vec数据
	for (int i = 0; i < pTaskExecInfo->m_vecPolItemCom.size(); i++)
	{
		int nDevType = pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem->m_nDevTypeCode;//取出 巡检项设备类型编码  
		if (nDevType == enVoice)//声音检测 只需要统计所有起点和中间点里的vec存储的连续检测数据
		{
			//continue;//雷说连续声音检测先去掉


			CPolItemCamer *pPolItemCamer = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			if (pPolItemCamer->m_nCheckType == 1 && (pPolItemCamer->m_nCollectIndex == 0 || pPolItemCamer->m_nCollectIndex == 2))//持续任务主动上报类型 && 所有起点或者中间点
			{
				for (int j = 0; j < pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult.size(); j++)
				{
					CItemResultCamera *pItemResultCamer = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult[j];
					
					if (pItemResultCamer == nullptr)
					{
						continue;
					}

					CPdfCotVoiceInfo VoiceInfo;
					VoiceInfo.m_strAlmDesc = pItemResultCamer->m_sDataDesc;//报警描述
					VoiceInfo.m_dLocation = pItemResultCamer->m_dRealLocation;//位置(m)
					VoiceInfo.m_nRollerCode = pItemResultCamer->m_nRollerNum;//托辊号
					VoiceInfo.m_sRollerDesc = pItemResultCamer->m_sRollerDesc;//托辊号描述
					VoiceInfo.m_dValue = pItemResultCamer->m_dValue;//噪声值
					VoiceInfo.m_nAlmState = pItemResultCamer->m_nState;//报警状态 0:正常 1:高报 2:高高报 -1:低报 -2:低低报
					VoiceInfo.m_dtActionTime = pItemResultCamer->m_dActionTime;//add执行时间
					if (VoiceInfo.m_nAlmState == 0)
					{
						nCotNormalNUmber += 1;
					}
					else
					{
						nCotAlmNumber += 1;
					}
					switch (VoiceInfo.m_nAlmState)
					{
					case 0:
						VoiceInfo.m_strAlmDesc = A2T("正常");
						VoiceInfo.m_sRemark = A2T("高限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldH.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case 1:
						VoiceInfo.m_strAlmDesc = A2T("超高限");
						VoiceInfo.m_sRemark = A2T("高限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldH.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case 2:
						VoiceInfo.m_strAlmDesc = A2T("超高高限");
						VoiceInfo.m_sRemark = A2T("高高限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldHH.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case -1:
						VoiceInfo.m_strAlmDesc = A2T("小于低限");
						VoiceInfo.m_sRemark = A2T("低限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldL.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case -2:
						VoiceInfo.m_strAlmDesc = A2T("小于低低限");
						VoiceInfo.m_sRemark = A2T("低低限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldLL.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					default:
						VoiceInfo.m_sRemark = A2T(""); //备注
						break;
					}
					
					reportInfo.m_VecCotVoiceInfo.push_back(VoiceInfo);
				}

				
			}
		}
		else if (nDevType == enIR)
		{
			CPolItemCamer *pPolItemCamer = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			if (pPolItemCamer->m_nCheckType == 1 && (pPolItemCamer->m_nCollectIndex == 0 || pPolItemCamer->m_nCollectIndex == 2))//持续任务主动上报类型 && 所有起点或者中间点
			{
				for (int j = 0; j < pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult.size(); j++)
				{
					CItemResultCamera *pItemResultCamer = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult[j];

					if (pItemResultCamer == nullptr)
					{
						continue;
					}

					CPdfCotIrInfo IrInfo;
					IrInfo.m_doMeasurementVal = pItemResultCamer->m_dTempMax;//测量数值 使用最高温度
					IrInfo.m_dLocation = pItemResultCamer->m_dRealLocation;//位置(m)
					IrInfo.m_nRollerCode = pItemResultCamer->m_nRollerNum;//托辊号
					IrInfo.m_sRollerDesc = pItemResultCamer->m_sRollerDesc;//托辊号描述
					IrInfo.m_nAlmState = pItemResultCamer->m_nState;//报警状态 0:正常 1:高报 2:高高报 -1:低报 -2:低低报
					IrInfo.m_dtActionTime = pItemResultCamer->m_dActionTime;//add执行时间
					if (IrInfo.m_nAlmState == 0)//正常
					{
						nCotNormalNUmber += 1;
					}
					else if (IrInfo.m_nAlmState == -1 || IrInfo.m_nAlmState == -2 || IrInfo.m_nAlmState == 1 || IrInfo.m_nAlmState == 2)//异常
					{
						nCotAlmNumber += 1;
					}
					else
					{
						//未执行不考虑
					}
					
					if (-2 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("小于低低限");
						strTemp = A2T("低低限%1%2").arg(pItemResultCamer->m_sDataThreadHoldLL).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
						
					}
					else if (-1 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("小于低限");
						strTemp = A2T("低限%1%2").arg(pItemResultCamer->m_sDataThreadHoldL).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (0 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("正常");
						strTemp = A2T("高限%1%2").arg(pItemResultCamer->m_sDataThreadHoldH).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (1 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("超高限");
						strTemp = A2T("高限%1%2").arg(pItemResultCamer->m_sDataThreadHoldH).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (2 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("超高高限");
						strTemp = A2T("高高限%1%2").arg(pItemResultCamer->m_sDataThreadHoldHH).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else
					{

					}

					//strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃\n%4").arg(pItemResultCamer->m_dTempAverage).arg(pItemResultCamer->m_dTempMin).arg(pItemResultCamer->m_dTempMax).arg(pItemResultCamer->m_sDataDesc);
					strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃").arg(pItemResultCamer->m_dTempAverage).arg(pItemResultCamer->m_dTempMin).arg(pItemResultCamer->m_dTempMax);
					IrInfo.m_sPictureRemark = strTemp;

					//InfraredThermometryInspecItemInfo.m_strPictureAddress = pCamerResult->m_sImageVeidoUrl;
					IrInfo.m_sPictureAddress = pItemResultCamer->m_sIRUrl;//原始红外相机 图片地址 (所有图片视频地址由原来的一个字段现在做出了区分)

					reportInfo.m_VecCotIrInfo.push_back(IrInfo);
					

				}
			}

		}
		else if (nDevType == enCamer)//图像相机
		{
			CPolItemCamer *pPolItemCamer = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			if (pPolItemCamer->m_nCheckType == 1 && (pPolItemCamer->m_nCollectIndex == 0 || pPolItemCamer->m_nCollectIndex == 2))//持续任务主动上报类型 && 所有起点或者中间点
			{
				for (int j = 0; j < pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult.size(); j++)
				{
					CItemResultCamera *pItemResultCamer = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult[j];

					if (pItemResultCamer == nullptr)
					{
						continue;
					}

					CPdfCotImageInfo ImageInfo;
					ImageInfo.m_dLocation = pItemResultCamer->m_dRealLocation;//位置(m)
					ImageInfo.m_nRollerCode = pItemResultCamer->m_nRollerNum;//托辊号
					ImageInfo.m_sRollerDesc = pItemResultCamer->m_sRollerDesc;//托辊号描述
					ImageInfo.m_dtActionTime = pItemResultCamer->m_dActionTime;//add执行时间
					ImageInfo.m_nAlmState = 0;//图像相机默认正常
					nCotNormalNUmber += 1;//图像相机都是正常

					ImageInfo.m_sPictureRemark = A2T("/");;//图片备注为空

					ImageInfo.m_sHttpPicAddr = pItemResultCamer->m_sHttpUrl;//http图片地址

					reportInfo.m_VecCotImageInfo.push_back(ImageInfo);

				}
			}
		}
}


	//==================组装普通信息=====================
	QString sClientCompanyName = CPublicData::instance().m_sCustomName;
	reportInfo.m_trClientCompanyNameTemp = sClientCompanyName;//客户电厂名称
	reportInfo.m_strRobotName = pDevData->m_sRobName;//机器人名称 "南电#1机器人"
	reportInfo.m_strTaskName = pTaskExecInfo->m_sTaskName;//巡检任务名称 "全面巡检任务"
	reportInfo.m_strTaskTime = dtTimeCurrent.toString("yyyy-MM-dd");//巡检日期 "2023-11-14"
	reportInfo.m_strComment = strComment;//备注
	reportInfo.m_strTaskStartTime = pTaskExecInfo->m_sStartTime;//任务开始时间 "09:00:00"
	reportInfo.m_strTaskEndTime = pTaskExecInfo->m_sEndTime;//任务结束时间 "09:30:00"
	reportInfo.m_strTaskStartElectricalValue = QString::number(pTaskExecInfo->m_dStartPower);//任务开始电量"80%"
	reportInfo.m_strTaskEndElectricalValue = QString::number(pTaskExecInfo->m_dEndPower);//任务开始电量"80%"
	reportInfo.m_strTaskState = pTaskExecInfo->m_sTaskExecDes;//任务状态

	//==================组装巡检点信息(包含巡检项)=====================
	//使用巡检点来包含巡检项 (CFormInspectionPointInfo 这个巡检点管理数组)
	QMap<QString, CFormInspectionPointInfo> mapFormInspectionPointInfo;// QString:巡检点Guid  CFormInspectionPointInfo:输出pdf巡检点全部信息
	for (int i = 0; i < pTaskExecInfo->m_vecPolItemCom.size(); i++)//遍历巡检项,创建巡检点Map
	{
		//排除连续检测巡检项类型
		if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 1)//云台
		{
			CPolItemCamer* pPolItemCamerData = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			//首先如果是持续监测主动上报的巡检项，则跳过
			if (pPolItemCamerData->m_nCheckType == 1)
			{
				continue;
			}
		}
		
		
		//先找出巡检点id
		CPolPoint *pPointTemp = pTaskExecInfo->m_vecPolItemCom[i]->m_pPolPoint;
		QString sPointGuid = pPointTemp->m_sPointGuid;
		//赋值巡检点基本信息
		CFormInspectionPointInfo FormPointInfo;
		FormPointInfo.m_douPointSortIndex = i;//排序号(不显示在表格里,用于给巡检点排序的)
		FormPointInfo.m_strInspectionPointName = pPointTemp->m_sPointName;//巡检点名称
		FormPointInfo.m_nRollerCode = pPointTemp->m_nRollerCode;//托辊号
		FormPointInfo.m_sRollerDesc = pPointTemp->m_sRollerDesc;//托辊描述信息
		FormPointInfo.m_strRobotName = pDevData->m_sRobName;//机器人名称
		double ddd = pPointTemp->m_dPointLocation / 1000;
		
#if 0
		//添加托辊号
		//先匹配托辊号
		FormPointInfo.m_nRollerCode = CPdfReport::getRollerCode(pPointTemp->m_dPointLocation / 1000, pDevData);
		if (FormPointInfo.m_nRollerCode > 0)
		{
			//发耳有托辊号(位置这里不显示托辊号了)
			strTemp = A2T("%1m(托辊:%2)").arg(QString::number(pPointTemp->m_dPointLocation / 1000, 'f', 1)).arg(FormPointInfo.m_nRollerCode);
			FormPointInfo.m_strLocation = strTemp;//位置
		}
		else
		{
			//无托辊号位置只显示多少m
			strTemp = A2T("%1m").arg(pPointTemp->m_dPointLocation / 1000);//需要除以1000换算
			FormPointInfo.m_strLocation = strTemp;//位置
		}
#endif
		strTemp = A2T("%1m").arg(QString::number(pPointTemp->m_dPointLocation / 1000, 'f', 1));//需要除以1000换算
		FormPointInfo.m_strLocation = strTemp;//位置

		FormPointInfo.m_dLocation = pPointTemp->m_dPointLocation;
		if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 1)//云台
		{
			CItemResultCamera *pCamerResult = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			FormPointInfo.m_strInspectDate = pCamerResult->m_dActionTime.toString("yyyy-MM-dd");//巡检日期 2023-11-13
			FormPointInfo.m_strInspectTime = pCamerResult->m_dActionTime.toString("hh:mm:ss");;//巡检时间 09:04:00
		}
		else if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 0)//本体传感器
		{
			CItemResultSensor *pSensorResult = (CItemResultSensor *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			FormPointInfo.m_strInspectDate = pSensorResult->m_dActionTime.toString("yyyy-MM-dd");//巡检日期 2023-11-13
			FormPointInfo.m_strInspectTime = pSensorResult->m_dActionTime.toString("hh:mm:ss");;//巡检时间 09:04:00
		}
		FormPointInfo.m_strRemark = "";//备注(暂时为空，预留)

		if (!mapFormInspectionPointInfo.contains(sPointGuid))
		{
			mapFormInspectionPointInfo.insert(sPointGuid, FormPointInfo);
		}
		else
		{
			//如果选检点GUid相同,需要判断托辊描述信息包含
			if (FormPointInfo.m_sRollerDesc.size() > 0)//托辊描述不为空
			{
				if (!mapFormInspectionPointInfo[sPointGuid].m_sRollerDesc.contains(FormPointInfo.m_sRollerDesc))
				{
					//如果不包含 需要追加
					mapFormInspectionPointInfo[sPointGuid].m_sRollerDesc += "-";
					mapFormInspectionPointInfo[sPointGuid].m_sRollerDesc += FormPointInfo.m_sRollerDesc;
				}
			}
			
		}
	}

	//给巡检点Map中的各个巡检项归位
	for (int i = 0; i < pTaskExecInfo->m_vecPolItemCom.size(); i++)//遍历巡检项,巡检项归位巡检点中
	{
		if (false == pTaskExecInfo->m_vecPolItemCom[i]->m_bIsAction)//未执行的巡检项不展示
		{
			continue;
		}

		//先找出巡检点id
		CPolPoint *pPointTemp = pTaskExecInfo->m_vecPolItemCom[i]->m_pPolPoint;
		QString sPointGuid = pPointTemp->m_sPointGuid;

		if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 1)//云台
		{
			//目前输出红外和图像
			CItemResultCamera *pCamerResult = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			if (1 == pCamerResult->m_nCheckType)//如果是持续任务上报类型,作为起点、中间点、终点啥的不展示
			{
				continue;
			}

			switch (pCamerResult->m_nDevTypeCode)
			{
			case enIR://红外
			{
				CPdfOutInspecItemInfoAll InfraredThermometryInspecItemInfo;
				InfraredThermometryInspecItemInfo.emPdfOutItemType = EmPdfOutItemTypeDef::EN_InfraredThermometry;
				InfraredThermometryInspecItemInfo.m_doMeasurementVal = pCamerResult->m_dTempMax;//测量数值 使用最高温度
				InfraredThermometryInspecItemInfo.m_strUnit = A2T("℃");
				InfraredThermometryInspecItemInfo.m_sItemName = pCamerResult->m_sItemName;//新增巡检项名称
				if (-2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pCamerResult->m_sDataThreadHoldLL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pCamerResult->m_sDataThreadHoldL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (0 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("正常");
					InfraredThermometryInspecItemInfo.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pCamerResult->m_sDataThreadHoldHH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-10 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("未执行");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					InfraredThermometryInspecItemInfo.m_strRemark = A2T("未执行");
				}

				//strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃\n%4").arg(pCamerResult->m_dTempAverage).arg(pCamerResult->m_dTempMin).arg(pCamerResult->m_dTempMax).arg(pCamerResult->m_sDataDesc);
				strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃").arg(pCamerResult->m_dTempAverage).arg(pCamerResult->m_dTempMin).arg(pCamerResult->m_dTempMax);
				InfraredThermometryInspecItemInfo.m_strPictureRemark = strTemp;

				//InfraredThermometryInspecItemInfo.m_strPictureAddress = pCamerResult->m_sImageVeidoUrl;
				InfraredThermometryInspecItemInfo.m_strPictureAddress = pCamerResult->m_sIRUrl;//原始红外相机 图片地址 (所有图片视频地址由原来的一个字段现在做出了区分)

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(InfraredThermometryInspecItemInfo);
			}
			break;
			case enCamer:
			{
				CPdfOutInspecItemInfoAll InfraredThermometryInspecItemInfo;
				InfraredThermometryInspecItemInfo.emPdfOutItemType = EmPdfOutItemTypeDef::EN_PhotoGraph;
				//InfraredThermometryInspecItemInfo.m_doMeasurementVal = pCamerResult->m_dTempMax;//测量数值 AI检测无测量数值
				//InfraredThermometryInspecItemInfo.m_strUnit = A2T("℃");
				QString sPictureRemark = "";
				InfraredThermometryInspecItemInfo.m_sItemName = pCamerResult->m_sItemName;//新增巡检项名称
				if (1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("报警");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("");
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;

					sPictureRemark = pCamerResult->m_sDataDesc;
				}
				else
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("/");
					InfraredThermometryInspecItemInfo.m_bStateOk = true;
					strTemp = A2T("");
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;

					sPictureRemark = A2T("/");
				}

				
				InfraredThermometryInspecItemInfo.m_strPictureRemark = sPictureRemark;

				InfraredThermometryInspecItemInfo.m_sHttpPicAddr = pCamerResult->m_sHttpUrl;//http图片地址

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(InfraredThermometryInspecItemInfo);
			}
			break;
			case enVoice:
			{
				CPdfOutInspecItemInfoAll InfraredThermometryInspecItemInfo;
				InfraredThermometryInspecItemInfo.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Voice;
				InfraredThermometryInspecItemInfo.m_doMeasurementVal = pCamerResult->m_dValue;//测量数值
				InfraredThermometryInspecItemInfo.m_strUnit = A2T("dB");//单位
				InfraredThermometryInspecItemInfo.m_sItemName = pCamerResult->m_sItemName;//新增巡检项名称

				if (-2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pCamerResult->m_sDataThreadHoldLL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pCamerResult->m_sDataThreadHoldL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (0 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("正常");
					InfraredThermometryInspecItemInfo.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pCamerResult->m_sDataThreadHoldHH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-10 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("未执行");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					InfraredThermometryInspecItemInfo.m_strRemark = A2T("未执行");
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(InfraredThermometryInspecItemInfo);

			}
			break;
			default:
				break;
			}
		}
		else if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 0)//本体传感器
		{
			CItemResultSensor *pSensorResult = (CItemResultSensor *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			switch (pSensorResult->m_nDevTypeCode)
			{
			case enPM25://气体传感器PM2.5
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_PM25;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ug/m3");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-10 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("未执行");
					ItemInfoTemp.m_bStateOk = false;
					ItemInfoTemp.m_strRemark = A2T("未执行");;
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enPM10://气体传感器PM10
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_PM10;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ug/m3");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-10 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("未执行");
					ItemInfoTemp.m_bStateOk = false;
					ItemInfoTemp.m_strRemark = A2T("未执行");;
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enTemp://温度传感
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Temperature;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("℃");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-10 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("未执行");
					ItemInfoTemp.m_bStateOk = false;
					ItemInfoTemp.m_strRemark = A2T("未执行");;
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enGas://可燃气体
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_CombustibleGas;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ppm");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-10 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("未执行");
					ItemInfoTemp.m_bStateOk = false;
					ItemInfoTemp.m_strRemark = A2T("未执行");;
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enCO://一氧化碳
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Co;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ppm");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-10 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("未执行");
					ItemInfoTemp.m_bStateOk = false;
					ItemInfoTemp.m_strRemark = A2T("未执行");;
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enHum://湿度
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Humidity;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("%RH");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-10 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("未执行");
					ItemInfoTemp.m_bStateOk = false;
					ItemInfoTemp.m_strRemark = A2T("未执行");;
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;

			default:
				break;
			}
		}

	}

	strTemp = A2T("%1个").arg(mapFormInspectionPointInfo.size());
	reportInfo.m_strInspectionPointCount = strTemp;//巡检点数量"7个"

	//strTemp = A2T("%1项").arg(QString::number(pTaskExecInfo->m_nItemCount + nCotNormalNUmber + nCotAlmNumber));
	//reportInfo.m_strInspectionItemCount = strTemp;//巡检项数量 "30项"

	strTemp = A2T("%1项").arg(QString::number(pTaskExecInfo->m_nExecItemCount - pTaskExecInfo->m_nAlarmItemCount + nCotNormalNUmber));
	reportInfo.m_strInspectionItemNormalCount = strTemp;//巡检项正常数量 "28项"

	strTemp = A2T("%1项").arg(QString::number(pTaskExecInfo->m_nAlarmItemCount + nCotAlmNumber));
	reportInfo.m_strInspectionItemAbnormalCount = strTemp;//巡检项异常数量 "2项"
	reportInfo.m_nInspectionItemAbnormalCount = pTaskExecInfo->m_nAlarmItemCount + nCotAlmNumber;

	//巡检项数量改成:正常+异常
	strTemp = A2T("%1项").arg(QString::number((pTaskExecInfo->m_nExecItemCount - pTaskExecInfo->m_nAlarmItemCount + nCotNormalNUmber) + (pTaskExecInfo->m_nAlarmItemCount + nCotAlmNumber)));
	reportInfo.m_strInspectionItemCount = strTemp;//巡检项数量 "30项"

	//新增异常项简明列表(异常项简要信息列表,有几项，增加几行)
	for (QMap<QString, CFormInspectionPointInfo>::iterator i = mapFormInspectionPointInfo.begin(); i != mapFormInspectionPointInfo.end(); i++)//遍历巡检点信息
	{
		//遍历这个点里面的巡检项
		for (int j = 0; j < i.value().m_vecInspecItemsInfo.size(); j++)
		{
			if (i.value().m_vecInspecItemsInfo[j].m_bStateOk == false)
			{
				QString strItemNameTemp = "";//巡检项名称
				switch (i.value().m_vecInspecItemsInfo[j].emPdfOutItemType)
				{
				case EmPdfOutItemTypeDef::EN_None:
				{
					strItemNameTemp = A2T("NULL");
				}
				break;
				case EmPdfOutItemTypeDef::EN_PM25:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("PM2.5");
				}
				break;
				case EmPdfOutItemTypeDef::EN_PM10:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("PM10");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Co:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("一氧化碳");
				}
				break;
				case EmPdfOutItemTypeDef::EN_CombustibleGas:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("可燃气体");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Temperature:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("温度");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Humidity:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("湿度");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Voice:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("噪声");
				}
				break;
				case EmPdfOutItemTypeDef::EN_InfraredThermometry:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
				}
				break;
				case EmPdfOutItemTypeDef::EN_PhotoGraph:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
				}
				break;
#if 0
				case EmPdfOutItemTypeDef::EN_BeltOffTrack:
				{
					strItemNameTemp = A2T("皮带跑偏");
				}
				break;
#endif
				default:
				{
					strItemNameTemp = A2T("NULL");
				}
				break;
				}

				//QString strAbnormalBriefTemp = A2T("%1的%2%3").arg(i.value().m_strInspectionPointName).arg(strItemNameTemp).arg(i.value().m_vecInspecItemsInfo[j].m_strState);
				QString strAbnormalBriefTemp = A2T("%1%2").arg(strItemNameTemp).arg(i.value().m_vecInspecItemsInfo[j].m_strState);
				reportInfo.m_vecAbnormalBriefList.push_back(strAbnormalBriefTemp);//把备注信息作为异常项简要信息
			}
		}
	}
	//异常项简明列表 需要加上统计连续红外的报警简要信息
	{
		QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfoNow;//连续红外结果数组
		getCotMapIrData(mapCotIrInfoNow, reportInfo.m_VecCotIrInfo);

		//遍历红外报警列表，往后继续绘制
		for (QMap<int, QVector<CPdfCotIrInfo>>::iterator j = mapCotIrInfoNow.begin(); j != mapCotIrInfoNow.end(); j++)
		{
			QVector<CPdfCotIrInfo> vecData = j.value();

			for (int nAlmIndex = 0; nAlmIndex < vecData.size(); nAlmIndex++)
			{
				if (vecData[nAlmIndex].m_nAlmState != 0)//只统计报警的
				{
					QString sAbnormalBriefInfo = A2T("%1托辊温度%2").arg(vecData[nAlmIndex].m_sRollerDesc).arg(vecData[nAlmIndex].m_strAlmDesc);
					reportInfo.m_vecAbnormalBriefList.push_back(sAbnormalBriefInfo);
				}
				
			}
		}
	}
	//异常项简明列表 需要加上统计连续噪声的报警简要信息
	{
		QMap<int, QVector<CPdfCotVoiceInfo>> mapCotVoiceInfoNow;//连续噪声结果数组
		getCotMapVoiceData(mapCotVoiceInfoNow, reportInfo.m_VecCotVoiceInfo);

		//遍历声音报警列表
		for (QMap<int, QVector<CPdfCotVoiceInfo>>::iterator j = mapCotVoiceInfoNow.begin(); j != mapCotVoiceInfoNow.end(); j++)
		{
			QVector<CPdfCotVoiceInfo> vecData = j.value();

			for (int nAlmIndex = 0; nAlmIndex < vecData.size(); nAlmIndex++)
			{
				if (vecData[nAlmIndex].m_nAlmState != 0)//只统计报警的
				{
					QString sAbnormalBriefInfo = A2T("%1托辊噪声%2").arg(vecData[nAlmIndex].m_sRollerDesc).arg(vecData[nAlmIndex].m_strAlmDesc);
					reportInfo.m_vecAbnormalBriefList.push_back(sAbnormalBriefInfo);
				}

			}
		}
	}

	//合格率计算(合格巡检项数量/巡检项总数)-->(巡检项正常项数/巡检项数量)
	//double dPassPercent = (double)(pTaskExecInfo->m_nItemCount - pTaskExecInfo->m_nAlarmItemCount) / (double)pTaskExecInfo->m_nItemCount;
	double dPassPercent = (double)(pTaskExecInfo->m_nExecItemCount - pTaskExecInfo->m_nAlarmItemCount + nCotNormalNUmber) / (double)(pTaskExecInfo->m_nItemCount + nCotNormalNUmber + nCotAlmNumber);
	dPassPercent *= 100;
	int nPassPercent = (int)dPassPercent;
	strTemp = A2T("%1%").arg(QString::number(nPassPercent));
	reportInfo.m_strPercentOfPass = strTemp;//合格率(待添加)"90%"

	//输出目录
	//reportInfo.m_strOutputPdfFolder = "D:/RobotResult/";//默认输出目录
	reportInfo.m_strOutputPdfFolder = CPublicData::instance().m_sPdfOutputPath;//改成xml配置路径

	//当前系统时间
	QDateTime dtCurTime = QDateTime::currentDateTime();
	QString strCurrTime = dtCurTime.toString("yyyyMMddhhmmss");

	//创建文件夹
	QString strFolderTemp = reportInfo.m_strOutputPdfFolder+"Result/" + reportInfo.m_strRobotName + "/"+ QDateTime::currentDateTime().toString("yyyyMM")+"/";//文件夹+机器人名称组合+年月
	
	QDir folder(strFolderTemp);// 创建QDir对象
	if (!folder.exists())
	{
		// 文件夹不存在，则创建
		if (folder.mkpath("."))
		{
		}
		else
		{
		}
	}
	else
	{
	}
	//输出路径
	QString strOutPath = strFolderTemp + strCurrTime + A2T("任务报告.pdf");
	pTaskExecInfo->m_sPdfPath = strOutPath;
	QString sPdfPathUrl = CPublicData::instance().m_sHttpUrl + strOutPath.remove(reportInfo.m_strOutputPdfFolder);
	pTaskExecInfo->m_sPdfPathUrl = sPdfPathUrl.replace("#","%23");

	reportInfo.m_strOutputPdfFolder = pTaskExecInfo->m_sPdfPath;
	//最后将mapFormInspectionPointInfo按照巡检点的位置排序
	QVector<CFormInspectionPointInfo> vecPointInfo = mapFormInspectionPointInfo.values().toVector();
	qSort(vecPointInfo.begin(), vecPointInfo.end(), slotReport);
	reportInfo.m_vecFormInspectionPointInfo.append(vecPointInfo);

	return outputPdfReportInfo(reportInfo, sErrMsg);//输出pdf报表信息
}

//导出综合报表(机器人巡检任务、纠偏、撕裂)
bool CPdfReport::exportSynthReport(CTaskExecInfo* pTaskExecInfo, CDevDataBase* pDevData, QString strComment, CPdfRectifyInfo &CRectifyData, CPdfTearInfo &CTearData, CPdfExtraAiInfo &CExtraAiInfo, QString &sErrMsg)
{
	if (pTaskExecInfo == nullptr || pDevData == nullptr)
	{
		sErrMsg = A2T("机器人数据指针为空");
		return false;
	}
	QDateTime dtTimeCurrent = QDateTime::currentDateTime();//当前系统时间
	QString strTemp = "";

	//编辑pdf输出信息
	CPdfReportInfo reportInfo;
	reportInfo.m_strTaskActionId = pTaskExecInfo->m_sTaskExecGuid;//子任务Id(用于更新数据库中的pdf存储地址)

	//======================= 组装连续检测信息 =======================
	int nCotNormalNUmber = 0;//连续检测正常项数
	int nCotAlmNumber = 0;//连续检测异常项数
	//遍历所有巡检项，找到连续检测的 所有起点和中间点的 找到里面的vec数据
	for (int i = 0; i < pTaskExecInfo->m_vecPolItemCom.size(); i++)
	{
		int nDevType = pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem->m_nDevTypeCode;//取出 巡检项设备类型编码  
		if (nDevType == enVoice)//声音检测 只需要统计所有起点和中间点里的vec存储的连续检测数据
		{
			//continue;//雷说连续声音检测先去掉

			CPolItemCamer *pPolItemCamer = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			if (pPolItemCamer->m_nCheckType == 1 && (pPolItemCamer->m_nCollectIndex == 0 || pPolItemCamer->m_nCollectIndex == 2))//持续任务主动上报类型 && 所有起点或者中间点
			{
				for (int j = 0; j < pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult.size(); j++)
				{
					CItemResultCamera *pItemResultCamer = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult[j];

					if (pItemResultCamer == nullptr)
					{
						continue;
					}

					CPdfCotVoiceInfo VoiceInfo;
					//VoiceInfo.m_strAlmDesc = pItemResultCamer->m_sCamerDataAlmStr;//报警描述
					VoiceInfo.m_dLocation = pItemResultCamer->m_dRealLocation;//位置(m)
					VoiceInfo.m_nRollerCode = pItemResultCamer->m_nRollerNum;//托辊号
					VoiceInfo.m_sRollerDesc = pItemResultCamer->m_sRollerDesc;//托辊号描述(上面的int型废除)
					VoiceInfo.m_dValue = pItemResultCamer->m_dValue;//噪声值
					VoiceInfo.m_nAlmState = pItemResultCamer->m_nState;//报警状态 0:正常 1:高报 2:高高报 -1:低报 -2:低低报
					VoiceInfo.m_dtActionTime = pItemResultCamer->m_dActionTime;//add执行时间
					if (VoiceInfo.m_nAlmState == 0)
					{
						nCotNormalNUmber += 1;
					}
					else
					{
						nCotAlmNumber += 1;
					}
					switch (VoiceInfo.m_nAlmState)
					{
					case 0:
						VoiceInfo.m_strAlmDesc = A2T("正常");
						VoiceInfo.m_sRemark = A2T("高限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldH.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case 1:
						VoiceInfo.m_strAlmDesc = A2T("超高限");
						VoiceInfo.m_sRemark = A2T("高限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldH.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case 2:
						VoiceInfo.m_strAlmDesc = A2T("超高高限");
						VoiceInfo.m_sRemark = A2T("高高限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldHH.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case -1:
						VoiceInfo.m_strAlmDesc = A2T("小于低限");
						VoiceInfo.m_sRemark = A2T("低限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldL.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					case -2:
						VoiceInfo.m_strAlmDesc = A2T("小于低低限");
						VoiceInfo.m_sRemark = A2T("低低限:%1%2").arg(QString::number(pItemResultCamer->m_sDataThreadHoldLL.toDouble(), 'f', 1)).arg(A2T("dB"));//备注
						break;
					default:
						VoiceInfo.m_sRemark = A2T(""); //备注
						break;
					}

					reportInfo.m_VecCotVoiceInfo.push_back(VoiceInfo);
				}


			}
		}
		else if (nDevType == enIR)
		{
			CPolItemCamer *pPolItemCamer = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			if (pPolItemCamer->m_nCheckType == 1 && (pPolItemCamer->m_nCollectIndex == 0 || pPolItemCamer->m_nCollectIndex == 2))//持续任务主动上报类型 && 所有起点或者中间点
			{
				for (int j = 0; j < pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult.size(); j++)
				{
					CItemResultCamera *pItemResultCamer = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult[j];

					if (pItemResultCamer == nullptr)
					{
						continue;
					}

					CPdfCotIrInfo IrInfo;
					IrInfo.m_doMeasurementVal = pItemResultCamer->m_dTempMax;//测量数值 使用最高温度
					IrInfo.m_dLocation = pItemResultCamer->m_dRealLocation;//位置(m)
					IrInfo.m_nRollerCode = pItemResultCamer->m_nRollerNum;//托辊号
					IrInfo.m_sRollerDesc = pItemResultCamer->m_sRollerDesc;//托辊号描述(上面的int型废除)
					IrInfo.m_nAlmState = pItemResultCamer->m_nState;//报警状态 0:正常 1:高报 2:高高报 -1:低报 -2:低低报
					IrInfo.m_dtActionTime = pItemResultCamer->m_dActionTime;//add执行时间
					if (IrInfo.m_nAlmState == 0)
					{
						nCotNormalNUmber += 1;
					}
					else if (IrInfo.m_nAlmState == -1 || IrInfo.m_nAlmState == -2 || IrInfo.m_nAlmState == 1 || IrInfo.m_nAlmState == 2)//异常
					{
						nCotAlmNumber += 1;
					}
					else
					{
						//未执行不考虑
					}

					if (-2 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("小于低低限");
						strTemp = A2T("低低限%1%2").arg(pItemResultCamer->m_sDataThreadHoldLL).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (-1 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("小于低限");
						strTemp = A2T("低限%1%2").arg(pItemResultCamer->m_sDataThreadHoldL).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (0 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("正常");
						strTemp = A2T("高限%1%2").arg(pItemResultCamer->m_sDataThreadHoldH).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (1 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("超高限");
						strTemp = A2T("高限%1%2").arg(pItemResultCamer->m_sDataThreadHoldH).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else if (2 == pItemResultCamer->m_nState)
					{
						IrInfo.m_strAlmDesc = A2T("超高高限");
						strTemp = A2T("高高限%1%2").arg(pItemResultCamer->m_sDataThreadHoldHH).arg(A2T("℃"));
						IrInfo.m_sRemark = strTemp;
					}
					else
					{

					}

					//strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃\n%4").arg(pItemResultCamer->m_dTempAverage).arg(pItemResultCamer->m_dTempMin).arg(pItemResultCamer->m_dTempMax).arg(pItemResultCamer->m_sDataDesc);
					strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃").arg(pItemResultCamer->m_dTempAverage).arg(pItemResultCamer->m_dTempMin).arg(pItemResultCamer->m_dTempMax);
					IrInfo.m_sPictureRemark = strTemp;

					//InfraredThermometryInspecItemInfo.m_strPictureAddress = pCamerResult->m_sImageVeidoUrl;
					IrInfo.m_sPictureAddress = pItemResultCamer->m_sIRUrl;//原始红外相机 图片地址 (所有图片视频地址由原来的一个字段现在做出了区分)

					reportInfo.m_VecCotIrInfo.push_back(IrInfo);


				}
			}

		}
		else if (nDevType == enCamer)//图像相机
		{
			CPolItemCamer *pPolItemCamer = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			if (pPolItemCamer->m_nCheckType == 1 && (pPolItemCamer->m_nCollectIndex == 0 || pPolItemCamer->m_nCollectIndex == 2))//持续任务主动上报类型 && 所有起点或者中间点
			{
				for (int j = 0; j < pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult.size(); j++)
				{
					CItemResultCamera *pItemResultCamer = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_vecItemResult[j];

					if (pItemResultCamer == nullptr)
					{
						continue;
					}

					CPdfCotImageInfo ImageInfo;
					ImageInfo.m_dLocation = pItemResultCamer->m_dRealLocation;//位置(m)
					ImageInfo.m_nRollerCode = pItemResultCamer->m_nRollerNum;//托辊号
					ImageInfo.m_sRollerDesc = pItemResultCamer->m_sRollerDesc;//托辊号描述
					ImageInfo.m_dtActionTime = pItemResultCamer->m_dActionTime;//add执行时间
					ImageInfo.m_nAlmState = 0;//图像相机默认正常
					nCotNormalNUmber += 1;//图像相机都是正常

					
					ImageInfo.m_sPictureRemark = A2T("/");;//图片备注为空

					ImageInfo.m_sHttpPicAddr = pItemResultCamer->m_sHttpUrl;//http图片地址

					reportInfo.m_VecCotImageInfo.push_back(ImageInfo);

				}
			}
		}
	}

	//==================组装普通信息=====================
	QString sClientCompanyName = CPublicData::instance().m_sCustomName;
	reportInfo.m_trClientCompanyNameTemp = sClientCompanyName;//客户电厂名称
	reportInfo.m_strRobotName = pDevData->m_sRobName;//机器人名称 "南电#1机器人"
	reportInfo.m_strTaskName = pTaskExecInfo->m_sTaskName;//巡检任务名称 "全面巡检任务"
	reportInfo.m_strTaskTime = dtTimeCurrent.toString("yyyy-MM-dd");//巡检日期 "2023-11-14"
	reportInfo.m_strComment = strComment;//备注
	reportInfo.m_strTaskStartTime = pTaskExecInfo->m_sStartTime;//任务开始时间 "09:00:00"
	reportInfo.m_strTaskEndTime = pTaskExecInfo->m_sEndTime;//任务结束时间 "09:30:00"
	reportInfo.m_strTaskStartElectricalValue = QString::number(pTaskExecInfo->m_dStartPower);//任务开始电量"80%"
	reportInfo.m_strTaskEndElectricalValue = QString::number(pTaskExecInfo->m_dEndPower);//任务开始电量"80%"
	reportInfo.m_strTaskState = pTaskExecInfo->m_sTaskExecDes;//任务状态

	//==================组装巡检点信息(包含巡检项)=====================
	//使用巡检点来包含巡检项 (CFormInspectionPointInfo 这个巡检点管理数组)
	QMap<QString, CFormInspectionPointInfo> mapFormInspectionPointInfo;// QString:巡检点Guid  CFormInspectionPointInfo:输出pdf巡检点全部信息
	for (int i = 0; i < pTaskExecInfo->m_vecPolItemCom.size(); i++)//遍历巡检项,创建巡检点Map
	{
		//排除连续检测巡检项类型
		if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 1)//云台
		{
			CPolItemCamer* pPolItemCamerData = (CPolItemCamer*)pTaskExecInfo->m_vecPolItemCom[i]->m_pPolItem;
			//首先如果是持续监测主动上报的巡检项，则跳过
			if (pPolItemCamerData->m_nCheckType == 1)
			{
				continue;
			}
		}

		//先找出巡检点id
		CPolPoint *pPointTemp = pTaskExecInfo->m_vecPolItemCom[i]->m_pPolPoint;
		QString sPointGuid = pPointTemp->m_sPointGuid;
		//赋值巡检点基本信息
		CFormInspectionPointInfo FormPointInfo;
		FormPointInfo.m_douPointSortIndex = i;//排序号(不显示在表格里,用于给巡检点排序的)
		FormPointInfo.m_strInspectionPointName = pPointTemp->m_sPointName;//巡检点名称
		FormPointInfo.m_nRollerCode = pPointTemp->m_nRollerCode;//托辊号
		FormPointInfo.m_sRollerDesc = pPointTemp->m_sRollerDesc;//托辊描述信息
		FormPointInfo.m_strRobotName = pDevData->m_sRobName;//机器人名称
		double ddd = pPointTemp->m_dPointLocation / 1000;

#if 0
		//添加托辊号
		//先匹配托辊号
		FormPointInfo.m_nRollerCode = CPdfReport::getRollerCode(pPointTemp->m_dPointLocation / 1000, pDevData);
		if (FormPointInfo.m_nRollerCode > 0)
		{
			//发耳有托辊号
			strTemp = A2T("%1m(托辊:%2)").arg(QString::number(pPointTemp->m_dPointLocation / 1000, 'f', 1)).arg(FormPointInfo.m_nRollerCode);
			FormPointInfo.m_strLocation = strTemp;//位置
		}
		else
		{
			//无托辊号位置只显示多少m
			strTemp = A2T("%1m").arg(pPointTemp->m_dPointLocation / 1000);//需要除以1000换算
			FormPointInfo.m_strLocation = strTemp;//位置
		}
#endif
		strTemp = A2T("%1m").arg(QString::number(pPointTemp->m_dPointLocation / 1000, 'f', 1));//需要除以1000换算
		FormPointInfo.m_strLocation = strTemp;//位置

		//strTemp = A2T("%1m").arg(pPointTemp->m_dPointLocation / 1000);//需要除以1000换算
		//FormPointInfo.m_strLocation = strTemp;//位置
		FormPointInfo.m_dLocation = pPointTemp->m_dPointLocation;
		if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 1)//云台
		{
			CItemResultCamera *pCamerResult = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			FormPointInfo.m_strInspectDate = pCamerResult->m_dActionTime.toString("yyyy-MM-dd");//巡检日期 2023-11-13
			FormPointInfo.m_strInspectTime = pCamerResult->m_dActionTime.toString("hh:mm:ss");;//巡检时间 09:04:00
		}
		else if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 0)//本体传感器
		{
			CItemResultSensor *pSensorResult = (CItemResultSensor *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			FormPointInfo.m_strInspectDate = pSensorResult->m_dActionTime.toString("yyyy-MM-dd");//巡检日期 2023-11-13
			FormPointInfo.m_strInspectTime = pSensorResult->m_dActionTime.toString("hh:mm:ss");;//巡检时间 09:04:00
		}
		FormPointInfo.m_strRemark = "";//备注(暂时为空，预留)
		if (!mapFormInspectionPointInfo.contains(sPointGuid))
		{
			mapFormInspectionPointInfo.insert(sPointGuid, FormPointInfo);
		}
		else
		{
			if (FormPointInfo.m_sRollerDesc.size() > 0)//托辊描述不为空
			{
				//如果选检点GUid相同,需要判断托辊描述信息包含
				if (!mapFormInspectionPointInfo[sPointGuid].m_sRollerDesc.contains(FormPointInfo.m_sRollerDesc))
				{
					//如果不包含 需要追加
					mapFormInspectionPointInfo[sPointGuid].m_sRollerDesc += "-";
					mapFormInspectionPointInfo[sPointGuid].m_sRollerDesc += FormPointInfo.m_sRollerDesc;
				}
			}
			
		}
	}

	//给巡检点Map中的各个巡检项归位
	for (int i = 0; i < pTaskExecInfo->m_vecPolItemCom.size(); i++)//遍历巡检项,巡检项归位巡检点中
	{
		if (false == pTaskExecInfo->m_vecPolItemCom[i]->m_bIsAction)//未执行的巡检项不展示
		{
			continue;
		}

		//先找出巡检点id
		CPolPoint *pPointTemp = pTaskExecInfo->m_vecPolItemCom[i]->m_pPolPoint;
		QString sPointGuid = pPointTemp->m_sPointGuid;

		if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 1)//云台
		{
			//目前输出红外和图像
			CItemResultCamera *pCamerResult = (CItemResultCamera *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			if (1 == pCamerResult->m_nCheckType)//如果是持续任务上报类型,作为起点、中间点、终点啥的不展示
			{
				continue;
			}

			switch (pCamerResult->m_nDevTypeCode)
			{
			case enIR://红外
			{
				CPdfOutInspecItemInfoAll InfraredThermometryInspecItemInfo;
				InfraredThermometryInspecItemInfo.emPdfOutItemType = EmPdfOutItemTypeDef::EN_InfraredThermometry;
				InfraredThermometryInspecItemInfo.m_doMeasurementVal = pCamerResult->m_dTempMax;//测量数值 使用最高温度
				InfraredThermometryInspecItemInfo.m_strUnit = A2T("℃");
				InfraredThermometryInspecItemInfo.m_sItemName = pCamerResult->m_sItemName;//新增巡检项名称
				if (-2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pCamerResult->m_sDataThreadHoldLL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pCamerResult->m_sDataThreadHoldL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (0 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("正常");
					InfraredThermometryInspecItemInfo.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pCamerResult->m_sDataThreadHoldHH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}

				//strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃\n%4").arg(pCamerResult->m_dTempAverage).arg(pCamerResult->m_dTempMin).arg(pCamerResult->m_dTempMax).arg(pCamerResult->m_sDataDesc);
				strTemp = A2T("平均温度:%1℃\n最低温度:%2℃\n最高温度:%3℃").arg(pCamerResult->m_dTempAverage).arg(pCamerResult->m_dTempMin).arg(pCamerResult->m_dTempMax);
				InfraredThermometryInspecItemInfo.m_strPictureRemark = strTemp;

				//InfraredThermometryInspecItemInfo.m_strPictureAddress = pCamerResult->m_sImageVeidoUrl;
				InfraredThermometryInspecItemInfo.m_strPictureAddress = pCamerResult->m_sIRUrl;//原始红外相机 图片地址 (所有图片视频地址由原来的一个字段现在做出了区分)

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(InfraredThermometryInspecItemInfo);
			}
			break;
			case enCamer:
			{
				CPdfOutInspecItemInfoAll InfraredThermometryInspecItemInfo;
				InfraredThermometryInspecItemInfo.emPdfOutItemType = EmPdfOutItemTypeDef::EN_PhotoGraph;
				//InfraredThermometryInspecItemInfo.m_doMeasurementVal = pCamerResult->m_dTempMax;//测量数值 AI检测无测量数值
				//InfraredThermometryInspecItemInfo.m_strUnit = A2T("℃");
				QString sPictureRemark = "";
				InfraredThermometryInspecItemInfo.m_sItemName = pCamerResult->m_sItemName;//新增巡检项名称
				if (1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("报警");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("");
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;

					sPictureRemark = pCamerResult->m_sDataDesc;
				}
				else
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("/");
					InfraredThermometryInspecItemInfo.m_bStateOk = true;
					strTemp = A2T("");
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;

					sPictureRemark = A2T("/");
				}


				InfraredThermometryInspecItemInfo.m_strPictureRemark = sPictureRemark;

				InfraredThermometryInspecItemInfo.m_sHttpPicAddr = pCamerResult->m_sHttpUrl;//http图片地址

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(InfraredThermometryInspecItemInfo);
			}
			break;
			case enVoice:
			{
				CPdfOutInspecItemInfoAll InfraredThermometryInspecItemInfo;
				InfraredThermometryInspecItemInfo.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Voice;
				InfraredThermometryInspecItemInfo.m_doMeasurementVal = pCamerResult->m_dValue;//测量数值
				InfraredThermometryInspecItemInfo.m_strUnit = A2T("dB");//单位
				InfraredThermometryInspecItemInfo.m_sItemName = pCamerResult->m_sItemName;//新增巡检项名称

				if (-2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pCamerResult->m_sDataThreadHoldLL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("小于低限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pCamerResult->m_sDataThreadHoldL).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (0 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("正常");
					InfraredThermometryInspecItemInfo.m_bStateOk = true;
					//正常显示高限
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (1 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pCamerResult->m_sDataThreadHoldH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (2 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("超高高限");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pCamerResult->m_sDataThreadHoldHH).arg(InfraredThermometryInspecItemInfo.m_strUnit);
					InfraredThermometryInspecItemInfo.m_strRemark = strTemp;
				}
				else if (-10 == pCamerResult->m_nState)
				{
					InfraredThermometryInspecItemInfo.m_strState = A2T("未执行");
					InfraredThermometryInspecItemInfo.m_bStateOk = false;
					InfraredThermometryInspecItemInfo.m_strRemark = A2T("未执行");
				}

				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(InfraredThermometryInspecItemInfo);

			}
			break;
			default:
				break;
			}
		}
		else if (pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult->m_nDevType == 0)//本体传感器
		{
			CItemResultSensor *pSensorResult = (CItemResultSensor *)pTaskExecInfo->m_vecPolItemCom[i]->m_ItemResult;
			switch (pSensorResult->m_nDevTypeCode)
			{
			case enPM25://气体传感器PM2.5
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_PM25;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ug/m3");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}


				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enPM10://气体传感器PM10
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_PM10;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ug/m3");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}


				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enTemp://温度传感
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Temperature;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("℃");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}


				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enGas://可燃气体
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_CombustibleGas;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ppm");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}


				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enCO://一氧化碳
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Co;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("ppm");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}


				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;
			case enHum://湿度
			{
				CPdfOutInspecItemInfoAll ItemInfoTemp;
				ItemInfoTemp.emPdfOutItemType = EmPdfOutItemTypeDef::EN_Humidity;
				ItemInfoTemp.m_doMeasurementVal = pSensorResult->m_dValue;//测量数值
				ItemInfoTemp.m_strUnit = A2T("%RH");
				ItemInfoTemp.m_sItemName = pSensorResult->m_sItemName;//新增巡检项名称
				if (-2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低低限%1%2").arg(pSensorResult->m_sDataThreadHoldLL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (-1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("小于低限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("低限%1%2").arg(pSensorResult->m_sDataThreadHoldL).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (0 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("正常");
					ItemInfoTemp.m_bStateOk = true;
					//正常就显示高限
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (1 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高限%1%2").arg(pSensorResult->m_sDataThreadHoldH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}
				else if (2 == pSensorResult->m_nState)
				{
					ItemInfoTemp.m_strState = A2T("超高高限");
					ItemInfoTemp.m_bStateOk = false;
					strTemp = A2T("高高限%1%2").arg(pSensorResult->m_sDataThreadHoldHH).arg(ItemInfoTemp.m_strUnit);
					ItemInfoTemp.m_strRemark = strTemp;
				}


				mapFormInspectionPointInfo[sPointGuid].m_vecInspecItemsInfo.push_back(ItemInfoTemp);
			}
			break;

			default:
				break;
			}
		}

	}

	strTemp = A2T("%1个").arg(mapFormInspectionPointInfo.size());
	reportInfo.m_strInspectionPointCount = strTemp;//巡检点数量"7个"

	//strTemp = A2T("%1项").arg(QString::number(pTaskExecInfo->m_nItemCount + nCotNormalNUmber + nCotAlmNumber));
	//reportInfo.m_strInspectionItemCount = strTemp;//巡检项数量 "30项"

	strTemp = A2T("%1项").arg(QString::number(pTaskExecInfo->m_nExecItemCount - pTaskExecInfo->m_nAlarmItemCount + nCotNormalNUmber));
	reportInfo.m_strInspectionItemNormalCount = strTemp;//巡检项正常数量 "28项"

	strTemp = A2T("%1项").arg(QString::number(pTaskExecInfo->m_nAlarmItemCount + nCotAlmNumber));
	reportInfo.m_strInspectionItemAbnormalCount = strTemp;//巡检项异常数量 "2项"
	reportInfo.m_nInspectionItemAbnormalCount = pTaskExecInfo->m_nAlarmItemCount + nCotAlmNumber;

	//巡检项数量改成:正常+异常
	strTemp = A2T("%1项").arg(QString::number((pTaskExecInfo->m_nExecItemCount - pTaskExecInfo->m_nAlarmItemCount + nCotNormalNUmber) + (pTaskExecInfo->m_nAlarmItemCount + nCotAlmNumber)));
	reportInfo.m_strInspectionItemCount = strTemp;//巡检项数量 "30项"


	//新增异常项简明列表(异常项简要信息列表,有几项，增加几行)
	for (QMap<QString, CFormInspectionPointInfo>::iterator i = mapFormInspectionPointInfo.begin(); i != mapFormInspectionPointInfo.end(); i++)//遍历巡检点信息
	{
		//遍历这个点里面的巡检项
		for (int j = 0; j < i.value().m_vecInspecItemsInfo.size(); j++)
		{
			if (i.value().m_vecInspecItemsInfo[j].m_bStateOk == false)
			{
				QString strItemNameTemp = "";//巡检项名称
				switch (i.value().m_vecInspecItemsInfo[j].emPdfOutItemType)
				{
				case EmPdfOutItemTypeDef::EN_None:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("NULL");
				}
				break;
				case EmPdfOutItemTypeDef::EN_PM25:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("PM2.5");
				}
				break;
				case EmPdfOutItemTypeDef::EN_PM10:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("PM10");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Co:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("一氧化碳");
				}
				break;
				case EmPdfOutItemTypeDef::EN_CombustibleGas:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("可燃气体");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Temperature:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("温度");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Humidity:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("湿度");
				}
				break;
				case EmPdfOutItemTypeDef::EN_Voice:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
					//strItemNameTemp = A2T("噪声");
				}
				break;
				case EmPdfOutItemTypeDef::EN_InfraredThermometry:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
				}
				break;
				case EmPdfOutItemTypeDef::EN_PhotoGraph:
				{
					strItemNameTemp = A2T("%1").arg(i.value().m_vecInspecItemsInfo[j].m_sItemName);
				}
				break;
#if 0
				case EmPdfOutItemTypeDef::EN_BeltOffTrack:
				{
					strItemNameTemp = A2T("皮带跑偏");
				}
				break;
#endif
				default:
				{
					strItemNameTemp = A2T("NULL");
				}
				break;
				}

				//QString strAbnormalBriefTemp = A2T("%1的%2%3").arg(i.value().m_strInspectionPointName).arg(strItemNameTemp).arg(i.value().m_vecInspecItemsInfo[j].m_strState);
				QString strAbnormalBriefTemp = A2T("%1%2").arg(strItemNameTemp).arg(i.value().m_vecInspecItemsInfo[j].m_strState);
				reportInfo.m_vecAbnormalBriefList.push_back(strAbnormalBriefTemp);//把备注信息作为异常项简要信息
			}
		}
	}
	//异常项简明列表 需要加上统计连续红外的报警简要信息
	{
		QMap<int, QVector<CPdfCotIrInfo>> mapCotIrInfoNow;//连续红外结果数组
		getCotMapIrData(mapCotIrInfoNow, reportInfo.m_VecCotIrInfo);

		//遍历红外报警列表，往后继续绘制
		for (QMap<int, QVector<CPdfCotIrInfo>>::iterator j = mapCotIrInfoNow.begin(); j != mapCotIrInfoNow.end(); j++)
		{
			QVector<CPdfCotIrInfo> vecData = j.value();

			for (int nAlmIndex = 0; nAlmIndex < vecData.size(); nAlmIndex++)
			{
				if (vecData[nAlmIndex].m_nAlmState != 0)//只统计报警的
				{
					QString sAbnormalBriefInfo = A2T("%1托辊温度%2").arg(vecData[nAlmIndex].m_sRollerDesc).arg(vecData[nAlmIndex].m_strAlmDesc);
					reportInfo.m_vecAbnormalBriefList.push_back(sAbnormalBriefInfo);
				}

			}
		}
	}
	//异常项简明列表 需要加上统计连续噪声的报警简要信息
	{
		QMap<int, QVector<CPdfCotVoiceInfo>> mapCotVoiceInfoNow;//连续噪声结果数组
		getCotMapVoiceData(mapCotVoiceInfoNow, reportInfo.m_VecCotVoiceInfo);

		//遍历声音报警列表
		for (QMap<int, QVector<CPdfCotVoiceInfo>>::iterator j = mapCotVoiceInfoNow.begin(); j != mapCotVoiceInfoNow.end(); j++)
		{
			QVector<CPdfCotVoiceInfo> vecData = j.value();

			for (int nAlmIndex = 0; nAlmIndex < vecData.size(); nAlmIndex++)
			{
				if (vecData[nAlmIndex].m_nAlmState != 0)//只统计报警的
				{
					QString sAbnormalBriefInfo = A2T("%1托辊噪声%2").arg(vecData[nAlmIndex].m_sRollerDesc).arg(vecData[nAlmIndex].m_strAlmDesc);
					reportInfo.m_vecAbnormalBriefList.push_back(sAbnormalBriefInfo);
				}

			}
		}
	}

	//合格率计算(合格巡检项数量/巡检项总数)-->(巡检项正常项数/巡检项数量)
	//double dPassPercent = (double)(pTaskExecInfo->m_nItemCount - pTaskExecInfo->m_nAlarmItemCount) / (double)pTaskExecInfo->m_nItemCount;
	double dPassPercent = (double)(pTaskExecInfo->m_nExecItemCount - pTaskExecInfo->m_nAlarmItemCount + nCotNormalNUmber) / (double)(pTaskExecInfo->m_nItemCount + nCotNormalNUmber + nCotAlmNumber);
	dPassPercent *= 100;
	int nPassPercent = (int)dPassPercent;
	strTemp = A2T("%1%").arg(QString::number(nPassPercent));
	reportInfo.m_strPercentOfPass = strTemp;//合格率(待添加)"90%"

	//输出目录
	//reportInfo.m_strOutputPdfFolder = "D:\\RobotResult\\Result";//默认输出目录
	reportInfo.m_strOutputPdfFolder = CPublicData::instance().m_sPdfOutputPath;//改成xml配置路径
	//当前系统时间
	QDateTime dtCurTime = QDateTime::currentDateTime();
	QString strCurrTime = dtCurTime.toString("yyyyMMddhhmmss");

	//创建文件夹
	QString strFolderTemp = reportInfo.m_strOutputPdfFolder + "Result/Synth/" + reportInfo.m_strRobotName + "/" + QDateTime::currentDateTime().toString("yyyyMM") + "/";//文件夹+机器人名称组合+年月
	//strFolderTemp += "Synth";//加上综合目录
	//strFolderTemp += "/";

	QDir folder(strFolderTemp);// 创建QDir对象
	if (!folder.exists())
	{
		// 文件夹不存在，则创建
		if (folder.mkpath("."))
		{
		}
		else
		{
		}
	}
	else
	{
	}
	//输出路径
	QString strOutPath = strFolderTemp + strCurrTime + A2T("综合报告.pdf");
	pTaskExecInfo->m_sSynthPdfPath = strOutPath;
	QString sPdfPathUrl = CPublicData::instance().m_sHttpUrl + strOutPath.remove(reportInfo.m_strOutputPdfFolder);
	pTaskExecInfo->m_sSynthPdfPathUrl = sPdfPathUrl.replace("#", "%23");

	reportInfo.m_strOutputPdfFolder = pTaskExecInfo->m_sSynthPdfPath;
	//最后将mapFormInspectionPointInfo按照巡检点的位置排序
	QVector<CFormInspectionPointInfo> vecPointInfo = mapFormInspectionPointInfo.values().toVector();
	qSort(vecPointInfo.begin(), vecPointInfo.end(), slotReport);
	reportInfo.m_vecFormInspectionPointInfo.append(vecPointInfo);

	return outputSynthPdfRptInfo(reportInfo, CRectifyData, CTearData, CExtraAiInfo, sErrMsg);//输出综合性报表(机器人巡检任务、纠偏、撕裂)
}
